Browse Source

test: improved type_mapping tests

pull/1149/head
missinglink 7 years ago committed by Peter Johnson
parent
commit
63c962503c
  1. 91
      test/unit/helper/type_mapping.js

91
test/unit/helper/type_mapping.js

@ -4,18 +4,31 @@ var type_mapping = require('../../../helper/type_mapping');
module.exports.tests = {};
module.exports.tests.interfaces = function(test, common) {
test('basic layer mapping', function(t) {
t.deepEquals(type_mapping.layer_mapping.venue, ['venue']);
t.deepEquals(type_mapping.layer_mapping.address, ['address']);
test('complete sources', function(t) {
t.deepEquals(type_mapping.sources, [ 'openstreetmap', 'openaddresses', 'geonames', 'whosonfirst' ]);
t.end();
});
test('alias layer mapping', function(t) {
t.deepEquals(type_mapping.layer_mapping.coarse,
[ 'continent', 'empire', 'country', 'dependency', 'macroregion',
'region', 'locality', 'localadmin', 'macrocounty', 'county', 'macrohood',
'borough', 'neighbourhood', 'microhood', 'disputed', 'postalcode',
'continent', 'ocean', 'marinearea']);
test('complete layers', function(t) {
t.deepEquals(type_mapping.layers, [ 'address', 'venue', 'street', 'country', 'macroregion',
'region', 'county', 'localadmin', 'locality', 'borough', 'neighbourhood', 'continent',
'empire', 'dependency', 'macrocounty', 'macrohood', 'microhood', 'disputed',
'postalcode', 'ocean', 'marinearea' ]);
t.end();
});
test('complete source mapping', function(t) {
t.deepEquals(type_mapping.source_mapping, {
osm: [ 'openstreetmap' ],
oa: [ 'openaddresses' ],
gn: [ 'geonames' ],
wof: [ 'whosonfirst' ],
openstreetmap: [ 'openstreetmap' ],
openaddresses: [ 'openaddresses' ],
geonames: [ 'geonames' ],
whosonfirst: [ 'whosonfirst' ]
});
t.end();
});
@ -30,6 +43,66 @@ module.exports.tests.interfaces = function(test, common) {
t.deepEquals(type_mapping.source_mapping.wof, ['whosonfirst']);
t.end();
});
test('complete layer mapping', function(t) {
t.deepEquals(type_mapping.layer_mapping, {
coarse: [ 'continent', 'empire', 'country', 'dependency', 'macroregion', 'region',
'locality', 'localadmin', 'macrocounty', 'county', 'macrohood', 'borough',
'neighbourhood', 'microhood', 'disputed', 'postalcode', 'continent', 'ocean', 'marinearea'
],
address: [ 'address' ],
venue: [ 'venue' ],
street: [ 'street' ],
country: [ 'country' ],
macroregion: [ 'macroregion' ],
region: [ 'region' ],
county: [ 'county' ],
localadmin: [ 'localadmin' ],
locality: [ 'locality' ],
borough: [ 'borough' ],
neighbourhood: [ 'neighbourhood' ],
continent: [ 'continent' ],
empire: [ 'empire' ],
dependency: [ 'dependency' ],
macrocounty: [ 'macrocounty' ],
macrohood: [ 'macrohood' ],
microhood: [ 'microhood' ],
disputed: [ 'disputed' ],
postalcode: [ 'postalcode' ],
ocean: [ 'ocean' ],
marinearea: [ 'marinearea' ]
});
t.end();
});
test('basic layer mapping', function(t) {
t.deepEquals(type_mapping.layer_mapping.venue, ['venue']);
t.deepEquals(type_mapping.layer_mapping.address, ['address']);
t.end();
});
test('alias layer mapping', function(t) {
t.deepEquals(type_mapping.layer_mapping.coarse,
[ 'continent', 'empire', 'country', 'dependency', 'macroregion',
'region', 'locality', 'localadmin', 'macrocounty', 'county', 'macrohood',
'borough', 'neighbourhood', 'microhood', 'disputed', 'postalcode',
'continent', 'ocean', 'marinearea']);
t.end();
});
test('complete layers by source', function(t) {
t.deepEquals(type_mapping.layers_by_source, {
openstreetmap: [ 'address', 'venue', 'street' ],
openaddresses: [ 'address' ],
geonames: [ 'country', 'macroregion', 'region', 'county', 'localadmin',
'locality', 'borough', 'neighbourhood', 'venue' ],
whosonfirst: [ 'continent', 'empire', 'country', 'dependency', 'macroregion',
'region', 'locality', 'localadmin', 'macrocounty', 'county', 'macrohood',
'borough', 'neighbourhood', 'microhood', 'disputed', 'venue', 'postalcode',
'continent', 'ocean', 'marinearea' ]
});
t.end();
});
};
module.exports.all = function (tape, common) {

Loading…
Cancel
Save