Browse Source

Revise tests to account for sizeCalculator setup params

pull/1097/head
Julian Simioni 7 years ago
parent
commit
825b506a75
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 10
      test/unit/helper/sizeCalculator.js

10
test/unit/helper/sizeCalculator.js

@ -1,11 +1,10 @@
var calcSizeMiddleware = require('../../../middleware/sizeCalculator.js');
var calcSize = require('../../../middleware/sizeCalculator.js')();
module.exports.tests = {}; module.exports.tests = {};
module.exports.tests.interface = function(test, common) { module.exports.tests.interface = function(test, common) {
test('interface', function(t) { test('interface', function(t) {
t.equal(typeof calcSize, 'function', 'valid function'); t.equal(typeof calcSizeMiddleware, 'function', 'valid function');
t.end(); t.end();
}); });
}; };
@ -24,6 +23,7 @@ module.exports.tests.valid = function(test, common) {
test('size=0', function (t) { test('size=0', function (t) {
setup(0); setup(0);
const calcSize = calcSizeMiddleware();
calcSize(req, {}, function () { calcSize(req, {}, function () {
t.equal(req.clean.querySize, 20); t.equal(req.clean.querySize, 20);
t.end(); t.end();
@ -32,6 +32,7 @@ module.exports.tests.valid = function(test, common) {
test('size=1', function (t) { test('size=1', function (t) {
setup(1); setup(1);
const calcSize = calcSizeMiddleware();
calcSize(req, {}, function () { calcSize(req, {}, function () {
t.equal(req.clean.querySize, 20); t.equal(req.clean.querySize, 20);
t.end(); t.end();
@ -40,6 +41,7 @@ module.exports.tests.valid = function(test, common) {
test('size=10', function (t) { test('size=10', function (t) {
setup(10); setup(10);
const calcSize = calcSizeMiddleware();
calcSize(req, {}, function () { calcSize(req, {}, function () {
t.equal(req.clean.querySize, 20); t.equal(req.clean.querySize, 20);
t.end(); t.end();
@ -48,6 +50,7 @@ module.exports.tests.valid = function(test, common) {
test('size=20', function (t) { test('size=20', function (t) {
setup(20); setup(20);
const calcSize = calcSizeMiddleware();
calcSize(req, {}, function () { calcSize(req, {}, function () {
t.equal(req.clean.querySize, 40); t.equal(req.clean.querySize, 40);
t.end(); t.end();
@ -56,6 +59,7 @@ module.exports.tests.valid = function(test, common) {
test('no size', function (t) { test('no size', function (t) {
setup(); setup();
const calcSize = calcSizeMiddleware();
calcSize(req, {}, function () { calcSize(req, {}, function () {
t.equal(req.clean.hasOwnProperty('querySize'), false); t.equal(req.clean.hasOwnProperty('querySize'), false);
t.end(); t.end();

Loading…
Cancel
Save