Browse Source

Use default config in search and autcomplete tests

The configurable boosts feature can case other unit tests to fail if a
user has customizations in their `pelias.json`.

This adds proxyquire to all tests that might be affected, which force
the default config, preventing such failures.
configurable-boosts
Julian Simioni 6 years ago
parent
commit
f3b11a16eb
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 12
      test/unit/query/autocomplete.js
  2. 12
      test/unit/query/search_original.js

12
test/unit/query/autocomplete.js

@ -1,4 +1,14 @@
var generate = require('../../../query/autocomplete');
const proxyquire = require('proxyquire').noCallThru();
const realPeliasConfig = require('pelias-config');
const defaultPeliasConfig = {
generate: function() {
return realPeliasConfig.defaults;
}
};
var generate = proxyquire('../../../query/autocomplete', {
'pelias-config': defaultPeliasConfig
});
module.exports.tests = {};

12
test/unit/query/search_original.js

@ -1,4 +1,14 @@
var generate = require('../../../query/search_original');
const proxyquire = require('proxyquire').noCallThru();
const realPeliasConfig = require('pelias-config');
const defaultPeliasConfig = {
generate: function() {
return realPeliasConfig.defaults;
}
};
var generate = proxyquire('../../../query/search_original', {
'pelias-config': defaultPeliasConfig
});
module.exports.tests = {};

Loading…
Cancel
Save