From 825b506a7522473ba422af0711d60ab2b01a7785 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Tue, 13 Mar 2018 12:22:08 -0400 Subject: [PATCH] Revise tests to account for sizeCalculator setup params --- test/unit/helper/sizeCalculator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/unit/helper/sizeCalculator.js b/test/unit/helper/sizeCalculator.js index 6c8d8d22..cbcd91b8 100644 --- a/test/unit/helper/sizeCalculator.js +++ b/test/unit/helper/sizeCalculator.js @@ -1,11 +1,10 @@ - -var calcSize = require('../../../middleware/sizeCalculator.js')(); +var calcSizeMiddleware = require('../../../middleware/sizeCalculator.js'); module.exports.tests = {}; module.exports.tests.interface = function(test, common) { test('interface', function(t) { - t.equal(typeof calcSize, 'function', 'valid function'); + t.equal(typeof calcSizeMiddleware, 'function', 'valid function'); t.end(); }); }; @@ -24,6 +23,7 @@ module.exports.tests.valid = function(test, common) { test('size=0', function (t) { setup(0); + const calcSize = calcSizeMiddleware(); calcSize(req, {}, function () { t.equal(req.clean.querySize, 20); t.end(); @@ -32,6 +32,7 @@ module.exports.tests.valid = function(test, common) { test('size=1', function (t) { setup(1); + const calcSize = calcSizeMiddleware(); calcSize(req, {}, function () { t.equal(req.clean.querySize, 20); t.end(); @@ -40,6 +41,7 @@ module.exports.tests.valid = function(test, common) { test('size=10', function (t) { setup(10); + const calcSize = calcSizeMiddleware(); calcSize(req, {}, function () { t.equal(req.clean.querySize, 20); t.end(); @@ -48,6 +50,7 @@ module.exports.tests.valid = function(test, common) { test('size=20', function (t) { setup(20); + const calcSize = calcSizeMiddleware(); calcSize(req, {}, function () { t.equal(req.clean.querySize, 40); t.end(); @@ -56,6 +59,7 @@ module.exports.tests.valid = function(test, common) { test('no size', function (t) { setup(); + const calcSize = calcSizeMiddleware(); calcSize(req, {}, function () { t.equal(req.clean.hasOwnProperty('querySize'), false); t.end();