|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
const setup = require('../../../controller/coarse_reverse'); |
|
|
|
|
const proxyquire = require('proxyquire').noCallThru(); |
|
|
|
|
const _ = require('lodash'); |
|
|
|
|
|
|
|
|
|
module.exports.tests = {}; |
|
|
|
|
|
|
|
|
@ -15,12 +16,13 @@ module.exports.tests.interface = (test, common) => {
|
|
|
|
|
|
|
|
|
|
module.exports.tests.early_exit_conditions = (test, common) => { |
|
|
|
|
test('should_execute returning false should not call service', (t) => { |
|
|
|
|
t.plan(2); |
|
|
|
|
|
|
|
|
|
const service = () => { |
|
|
|
|
throw Error('service should not have been called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return false; }; |
|
|
|
|
const controller = setup(service, should_execute); |
|
|
|
|
const controller = setup(service, _.constant(false)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -30,14 +32,12 @@ module.exports.tests.early_exit_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// passing res=undefined verifies that it wasn't interacted with
|
|
|
|
|
t.doesNotThrow(controller.bind(null, req, undefined, next)); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@ -46,6 +46,8 @@ module.exports.tests.early_exit_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
module.exports.tests.error_conditions = (test, common) => { |
|
|
|
|
test('service error should log and call next', (t) => { |
|
|
|
|
t.plan(3); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['locality'] } } ); |
|
|
|
|
callback('this is an error'); |
|
|
|
@ -53,10 +55,9 @@ module.exports.tests.error_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -65,16 +66,14 @@ module.exports.tests.error_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// passing res=undefined verifies that it wasn't interacted with
|
|
|
|
|
controller(req, undefined, next); |
|
|
|
|
|
|
|
|
|
t.ok(logger.isErrorMessage('this is an error')); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@ -83,6 +82,8 @@ module.exports.tests.error_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
module.exports.tests.success_conditions = (test, common) => { |
|
|
|
|
test('service returning results should use first entry for each layer', (t) => { |
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['neighbourhood'] } } ); |
|
|
|
|
|
|
|
|
@ -143,10 +144,9 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -157,9 +157,8 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
@ -211,7 +210,6 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
country_id: ['100'], |
|
|
|
|
country_a: ['xyz'] |
|
|
|
|
}, |
|
|
|
|
alpha3: 'XYZ', |
|
|
|
|
center_point: { |
|
|
|
|
lat: 12.121212, |
|
|
|
|
lon: 21.212121 |
|
|
|
@ -222,14 +220,14 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
|
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('layers missing from results should be ignored', (t) => { |
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['neighbourhood'] } } ); |
|
|
|
|
|
|
|
|
@ -238,7 +236,6 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
{ |
|
|
|
|
id: 10, |
|
|
|
|
name: 'neighbourhood name', |
|
|
|
|
abbr: 'neighbourhood abbr', |
|
|
|
|
centroid: { |
|
|
|
|
lat: 12.121212, |
|
|
|
|
lon: 21.212121 |
|
|
|
@ -253,10 +250,9 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -267,9 +263,8 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
@ -292,7 +287,7 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
parent: { |
|
|
|
|
neighbourhood: ['neighbourhood name'], |
|
|
|
|
neighbourhood_id: ['10'], |
|
|
|
|
neighbourhood_a: ['neighbourhood abbr'] |
|
|
|
|
neighbourhood_a: [null] |
|
|
|
|
}, |
|
|
|
|
center_point: { |
|
|
|
|
lat: 12.121212, |
|
|
|
@ -304,14 +299,14 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
|
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('most granular layer missing centroid should not set', (t) => { |
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['neighbourhood'] } } ); |
|
|
|
|
|
|
|
|
@ -331,10 +326,9 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -345,9 +339,8 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
@ -378,14 +371,14 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
|
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('most granular layer missing bounding_box should not set', (t) => { |
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['neighbourhood'] } } ); |
|
|
|
|
|
|
|
|
@ -408,10 +401,9 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -422,9 +414,8 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
@ -458,9 +449,254 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('no requested layers should use everything', (t) => { |
|
|
|
|
// this test is used to test coarse reverse fallback for when non-coarse reverse
|
|
|
|
|
// was requested but no non-coarse results were found
|
|
|
|
|
|
|
|
|
|
// by plan'ing the number of tests, we can verify that next() was called w/o
|
|
|
|
|
// additional bookkeeping
|
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
const results = { |
|
|
|
|
neighbourhood: [ |
|
|
|
|
{ |
|
|
|
|
id: 10, |
|
|
|
|
name: 'neighbourhood name', |
|
|
|
|
abbr: 'neighbourhood abbr' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
callback(undefined, results); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
|
layers: [], |
|
|
|
|
point: { |
|
|
|
|
lat: 12.121212, |
|
|
|
|
lon: 21.212121 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
const next = () => { |
|
|
|
|
t.pass('next() should have been called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
|
|
|
|
|
|
const expected = { |
|
|
|
|
meta: {}, |
|
|
|
|
data: [ |
|
|
|
|
{ |
|
|
|
|
_id: '10', |
|
|
|
|
_type: 'neighbourhood', |
|
|
|
|
layer: 'neighbourhood', |
|
|
|
|
source: 'whosonfirst', |
|
|
|
|
source_id: '10', |
|
|
|
|
name: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
phrase: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
parent: { |
|
|
|
|
neighbourhood: ['neighbourhood name'], |
|
|
|
|
neighbourhood_id: ['10'], |
|
|
|
|
neighbourhood_a: ['neighbourhood abbr'] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(req.clean.layers, [], 'req.clean.layers should be unmodified'); |
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('layers specifying only venue, address, or street should not exclude coarse results', (t) => { |
|
|
|
|
// this test is used to test coarse reverse fallback for when non-coarse reverse
|
|
|
|
|
// was requested but no non-coarse results were found
|
|
|
|
|
const non_coarse_layers = ['venue', 'address', 'street']; |
|
|
|
|
const tests_per_non_coarse_layer = 4; |
|
|
|
|
|
|
|
|
|
// by plan'ing the number of tests, we can verify that next() was called w/o
|
|
|
|
|
// additional bookkeeping
|
|
|
|
|
t.plan(non_coarse_layers.length * tests_per_non_coarse_layer); |
|
|
|
|
|
|
|
|
|
non_coarse_layers.forEach((non_coarse_layer) => { |
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
const results = { |
|
|
|
|
neighbourhood: [ |
|
|
|
|
{ |
|
|
|
|
id: 10, |
|
|
|
|
name: 'neighbourhood name', |
|
|
|
|
abbr: 'neighbourhood abbr' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
callback(undefined, results); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
|
layers: [non_coarse_layer], |
|
|
|
|
point: { |
|
|
|
|
lat: 12.121212, |
|
|
|
|
lon: 21.212121 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
const next = () => { |
|
|
|
|
t.pass('next() should have been called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
|
|
|
|
|
|
const expected = { |
|
|
|
|
meta: {}, |
|
|
|
|
data: [ |
|
|
|
|
{ |
|
|
|
|
_id: '10', |
|
|
|
|
_type: 'neighbourhood', |
|
|
|
|
layer: 'neighbourhood', |
|
|
|
|
source: 'whosonfirst', |
|
|
|
|
source_id: '10', |
|
|
|
|
name: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
phrase: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
parent: { |
|
|
|
|
neighbourhood: ['neighbourhood name'], |
|
|
|
|
neighbourhood_id: ['10'], |
|
|
|
|
neighbourhood_a: ['neighbourhood abbr'] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(req.clean.layers, [non_coarse_layer], 'req.clean.layers should be unmodified'); |
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('layers specifying venue, address, or street AND coarse layer should not exclude coarse results', (t) => { |
|
|
|
|
// this test is used to test coarse reverse fallback for when non-coarse reverse
|
|
|
|
|
// was requested but no non-coarse results were found
|
|
|
|
|
const non_coarse_layers = ['venue', 'address', 'street']; |
|
|
|
|
const tests_per_non_coarse_layer = 4; |
|
|
|
|
|
|
|
|
|
// by plan'ing the number of tests, we can verify that next() was called w/o
|
|
|
|
|
// additional bookkeeping
|
|
|
|
|
t.plan(non_coarse_layers.length * tests_per_non_coarse_layer); |
|
|
|
|
|
|
|
|
|
non_coarse_layers.forEach((non_coarse_layer) => { |
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
const results = { |
|
|
|
|
neighbourhood: [ |
|
|
|
|
{ |
|
|
|
|
id: 10, |
|
|
|
|
name: 'neighbourhood name', |
|
|
|
|
abbr: 'neighbourhood abbr' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
callback(undefined, results); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
|
layers: [non_coarse_layer, 'neighbourhood'], |
|
|
|
|
point: { |
|
|
|
|
lat: 12.121212, |
|
|
|
|
lon: 21.212121 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
const next = () => { |
|
|
|
|
t.pass('next() should have been called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
|
|
|
|
|
|
const expected = { |
|
|
|
|
meta: {}, |
|
|
|
|
data: [ |
|
|
|
|
{ |
|
|
|
|
_id: '10', |
|
|
|
|
_type: 'neighbourhood', |
|
|
|
|
layer: 'neighbourhood', |
|
|
|
|
source: 'whosonfirst', |
|
|
|
|
source_id: '10', |
|
|
|
|
name: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
phrase: { |
|
|
|
|
'default': 'neighbourhood name' |
|
|
|
|
}, |
|
|
|
|
parent: { |
|
|
|
|
neighbourhood: ['neighbourhood name'], |
|
|
|
|
neighbourhood_id: ['10'], |
|
|
|
|
neighbourhood_a: ['neighbourhood abbr'] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(req.clean.layers, [non_coarse_layer, 'neighbourhood'], 'req.clean.layers should be unmodified'); |
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@ -469,6 +705,8 @@ module.exports.tests.success_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
module.exports.tests.failure_conditions = (test, common) => { |
|
|
|
|
test('service returning 0 results at the requested layer should return nothing', (t) => { |
|
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
const service = (req, callback) => { |
|
|
|
|
t.deepEquals(req, { clean: { layers: ['neighbourhood'] } } ); |
|
|
|
|
|
|
|
|
@ -517,10 +755,9 @@ module.exports.tests.failure_conditions = (test, common) => {
|
|
|
|
|
|
|
|
|
|
const logger = require('pelias-mock-logger')(); |
|
|
|
|
|
|
|
|
|
const should_execute = () => { return true; }; |
|
|
|
|
const controller = proxyquire('../../../controller/coarse_reverse', { |
|
|
|
|
'pelias-logger': logger |
|
|
|
|
})(service, should_execute); |
|
|
|
|
})(service, _.constant(true)); |
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
|
clean: { |
|
|
|
@ -531,9 +768,8 @@ module.exports.tests.failure_conditions = (test, common) => {
|
|
|
|
|
const res = { }; |
|
|
|
|
|
|
|
|
|
// verify that next was called
|
|
|
|
|
let next_was_called = false; |
|
|
|
|
const next = () => { |
|
|
|
|
next_was_called = true; |
|
|
|
|
t.pass('next() was called'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
controller(req, res, next); |
|
|
|
@ -544,9 +780,7 @@ module.exports.tests.failure_conditions = (test, common) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
t.deepEquals(res, expected); |
|
|
|
|
|
|
|
|
|
t.notOk(logger.hasErrorMessages()); |
|
|
|
|
t.ok(next_was_called); |
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|