Browse Source

fix(test): Use default pelias-config for type tests

Without this change, a user's own `pelias.json` customizations can cause
the unit tests to fail.
pull/1204/head
Julian Simioni 6 years ago
parent
commit
ff5c66a269
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 2
      helper/type_mapping.js
  2. 18
      test/unit/helper/type_mapping.js

2
helper/type_mapping.js

@ -5,4 +5,4 @@ var tm = new TypeMapping();
tm.load();
// export singleton
module.exports = tm;
module.exports = tm;

18
test/unit/helper/type_mapping.js

@ -1,4 +1,20 @@
var type_mapping = require('../../../helper/type_mapping');
const proxyquire = require('proxyquire').noCallThru();
const realPeliasConfig = require('pelias-config');
const defaultPeliasConfig = {
generate: function() {
return realPeliasConfig.defaults;
}
};
// test the actual module, rather than the singleton wrapper
var TypeMapping = proxyquire('../../../helper/TypeMapping', {
'pelias-config': defaultPeliasConfig
});
const type_mapping = new TypeMapping();
type_mapping.load();
module.exports.tests = {};

Loading…
Cancel
Save