|
|
@ -15,7 +15,7 @@ module.exports.tests.interface = (test, common) => { |
|
|
|
|
|
|
|
|
|
|
|
module.exports.tests.success = (test, common) => { |
|
|
|
module.exports.tests.success = (test, common) => { |
|
|
|
test('successful request to search service should replace data and meta', (t) => { |
|
|
|
test('successful request to search service should replace data and meta', (t) => { |
|
|
|
t.plan(5); |
|
|
|
t.plan(4); |
|
|
|
|
|
|
|
|
|
|
|
const logger = mocklogger(); |
|
|
|
const logger = mocklogger(); |
|
|
|
|
|
|
|
|
|
|
@ -77,8 +77,6 @@ module.exports.tests.success = (test, common) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
t.ok(logger.isInfoMessage('[controller:search] [queryType:this is the query type] [es_result_count:2]')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -146,7 +144,7 @@ module.exports.tests.success = (test, common) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('undefined docs in response should not overwrite existing results', (t) => { |
|
|
|
test('undefined docs in response should not overwrite existing results', (t) => { |
|
|
|
t.plan(1+3); // ensures that search service was called, then req+res+logger tests
|
|
|
|
t.plan(1+2); // ensures that search service was called, then req+res+logger tests
|
|
|
|
|
|
|
|
|
|
|
|
const logger = mocklogger(); |
|
|
|
const logger = mocklogger(); |
|
|
|
|
|
|
|
|
|
|
@ -196,8 +194,6 @@ module.exports.tests.success = (test, common) => { |
|
|
|
meta: { key: 'value' } |
|
|
|
meta: { key: 'value' } |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
t.notOk(logger.isInfoMessage(/[controller:search] [queryType:this is the query type] [es_result_count:0]/)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -206,7 +202,7 @@ module.exports.tests.success = (test, common) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('empty docs in response should not overwrite existing results', (t) => { |
|
|
|
test('empty docs in response should not overwrite existing results', (t) => { |
|
|
|
t.plan(4); |
|
|
|
t.plan(3); |
|
|
|
|
|
|
|
|
|
|
|
const logger = mocklogger(); |
|
|
|
const logger = mocklogger(); |
|
|
|
|
|
|
|
|
|
|
@ -255,8 +251,6 @@ module.exports.tests.success = (test, common) => { |
|
|
|
meta: { key: 'value' } |
|
|
|
meta: { key: 'value' } |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
t.notOk(logger.isInfoMessage(/[controller:search] [queryType:this is the query type] [es_result_count:0]/)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -265,7 +259,7 @@ module.exports.tests.success = (test, common) => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('successful request on retry to search service should log info message', (t) => { |
|
|
|
test('successful request on retry to search service should log info message', (t) => { |
|
|
|
t.plan(3+2+2); // 3 search service calls, 2 log messages, 1 req, 1 res
|
|
|
|
t.plan(3+1+2); // 3 search service calls, 1 log messages, 1 req, 1 res
|
|
|
|
|
|
|
|
|
|
|
|
const logger = mocklogger(); |
|
|
|
const logger = mocklogger(); |
|
|
|
|
|
|
|
|
|
|
@ -337,7 +331,6 @@ module.exports.tests.success = (test, common) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
t.ok(logger.isInfoMessage('[controller:search] [queryType:this is the query type] [es_result_count:2]')); |
|
|
|
|
|
|
|
t.ok(logger.isInfoMessage('succeeded on retry 2')); |
|
|
|
t.ok(logger.isInfoMessage('succeeded on retry 2')); |
|
|
|
|
|
|
|
|
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|