|
|
|
@ -93,32 +93,32 @@ module.exports.tests.functional_success = function(test, common) {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// functionally test controller (backend failure)
|
|
|
|
|
// module.exports.tests.functional_failure = function(test, common) {
|
|
|
|
|
// test('functional failure', function(t) {
|
|
|
|
|
// var backend = mockBackend( 'client/suggest/fail/1', function( cmd ){
|
|
|
|
|
// if( cmd.body.docs ){
|
|
|
|
|
// t.deepEqual(cmd, {
|
|
|
|
|
// body: { docs: [
|
|
|
|
|
// { _id: 'mockid1', _index: 'pelias', _type: 'mocktype' },
|
|
|
|
|
// { _id: 'mockid2', _index: 'pelias', _type: 'mocktype' }]
|
|
|
|
|
// }
|
|
|
|
|
// }, 'correct mget command');
|
|
|
|
|
// } else if (cmd.body.layers) {
|
|
|
|
|
// // layers are set exclusively for admin: test for admin-only layers
|
|
|
|
|
// t.deepEqual(cmd, { body: { a: 'b', layers: [ 'admin0', 'admin1', 'admin2' ] }, index: 'pelias' },
|
|
|
|
|
// 'correct suggest/admin command');
|
|
|
|
|
// } else {
|
|
|
|
|
// t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias' }, 'correct suggest command');
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// var controller = setup( backend, mockQuery() );
|
|
|
|
|
// var next = function( message ){
|
|
|
|
|
// t.equal(message,'a backend error occurred','error passed to errorHandler');
|
|
|
|
|
// t.end();
|
|
|
|
|
// };
|
|
|
|
|
// controller( { clean: { a: 'b' } }, undefined, next );
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
module.exports.tests.functional_failure = function(test, common) { |
|
|
|
|
test('functional failure', function(t) { |
|
|
|
|
var backend = mockBackend( 'client/suggest/fail/1', function( cmd ){ |
|
|
|
|
if( cmd.body.docs ){ |
|
|
|
|
t.deepEqual(cmd, {
|
|
|
|
|
body: { docs: [
|
|
|
|
|
{ _id: 'mockid1', _index: 'pelias', _type: 'mocktype' },
|
|
|
|
|
{ _id: 'mockid2', _index: 'pelias', _type: 'mocktype' }]
|
|
|
|
|
}
|
|
|
|
|
}, 'correct mget command'); |
|
|
|
|
} else if (cmd.body.layers) { |
|
|
|
|
// layers are set exclusively for admin: test for admin-only layers
|
|
|
|
|
t.deepEqual(cmd, { body: { a: 'b', layers: [ 'admin0', 'admin1', 'admin2' ] }, index: 'pelias' },
|
|
|
|
|
'correct suggest/admin command'); |
|
|
|
|
} else { |
|
|
|
|
t.deepEqual(cmd, { body: { a: 'b' }, index: 'pelias' }, 'correct suggest command'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
var controller = setup( backend, mockQuery() ); |
|
|
|
|
var next = function( message ){ |
|
|
|
|
t.equal(message,'a backend error occurred','error passed to errorHandler'); |
|
|
|
|
}; |
|
|
|
|
controller( { clean: { a: 'b' } }, undefined, next ); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
|
|
|
|
|
|