Browse Source

Test handling of undefined configuration

cb_sorting
Julian Simioni 6 years ago
parent
commit
ae4d948127
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 3
      query/view/boost_sources_and_layers.js
  2. 7
      test/unit/query/view/boost_sources_and_layers.js

3
query/view/boost_sources_and_layers.js

@ -24,6 +24,9 @@ function generateTermQuery(field, value, boost) {
module.exports = function( configuration ) {
return function( ) {
if (!configuration) {
return null;
}
const filters = [];
['source', 'layer'].forEach(function(target) {
if (configuration[target]) {

7
test/unit/query/view/boost_sources_and_layers.js

@ -9,6 +9,13 @@ module.exports.tests.empty_config = function(test, common) {
t.equal(query, null, 'query is empty');
t.end();
});
test('undefined configuration returns empty query', function(t) {
const view_instance = boost_sources_and_layers(undefined);
const query = view_instance();
t.equal(query, null, 'query is empty');
t.end();
});
};
module.exports.tests.single_item_config = function(test, common) {

Loading…
Cancel
Save