Browse Source

Merge pull request #1204 from pelias/proxyquire-config

Use default pelias-config values for type mapping tests
pull/1208/head
Julian Simioni 6 years ago committed by GitHub
parent
commit
75b32123d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      test/unit/helper/type_mapping.js
  2. 14
      test/unit/sanitizer/_sources.js

19
test/unit/helper/type_mapping.js

@ -1,5 +1,20 @@
var check = require('check-types'); const proxyquire = require('proxyquire').noCallThru();
var type_mapping = require('../../../helper/type_mapping');
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 = {}; module.exports.tests = {};

14
test/unit/sanitizer/_sources.js

@ -1,5 +1,15 @@
var type_mapping = require('../../../helper/type_mapping'); const fake_type_mapping = {
var sanitizer = require( '../../../sanitizer/_targets' )('sources', type_mapping.source_mapping); osm:['openstreetmap'],
oa: ['openaddresses'],
gn: ['geonames'],
wof: ['whosonfirst'],
openstreetmap:['openstreetmap'],
openaddresses: ['openaddresses'],
geonames: ['geonames'],
whosonfirst: ['whosonfirst']
};
var sanitizer = require( '../../../sanitizer/_targets' )('sources', fake_type_mapping);
var success_messages = { error: false }; var success_messages = { error: false };

Loading…
Cancel
Save