From 94946989bb4c872085de452f10a5ed3a98409113 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Tue, 13 Mar 2018 12:24:59 -0400 Subject: [PATCH] Test cases with a lower min query size --- test/unit/helper/sizeCalculator.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/unit/helper/sizeCalculator.js b/test/unit/helper/sizeCalculator.js index cbcd91b8..fe4f9bb3 100644 --- a/test/unit/helper/sizeCalculator.js +++ b/test/unit/helper/sizeCalculator.js @@ -65,6 +65,33 @@ module.exports.tests.valid = function(test, common) { t.end(); }); }); + + test('no size, min query size 10', function (t) { + setup(); + const calcSize = calcSizeMiddleware(10); + calcSize(req, {}, function () { + t.equal(req.clean.hasOwnProperty('querySize'), false); + t.end(); + }); + }); + + test('size 5, min query size 10', function (t) { + setup(5); + const calcSize = calcSizeMiddleware(10); + calcSize(req, {}, function () { + t.equal(req.clean.querySize, 10); + t.end(); + }); + }); + + test('size 3, min query size 2', function (t) { + setup(3); + const calcSize = calcSizeMiddleware(2); + calcSize(req, {}, function () { + t.equal(req.clean.querySize, 6); + t.end(); + }); + }); }; module.exports.all = function (tape, common) {