Browse Source

add osm address type

pull/62/head
Peter Johnson 10 years ago
parent
commit
9d10f0fa49
  1. 1
      query/indeces.js
  2. 2
      sanitiser/_layers.js
  3. 2
      test/unit/query/indeces.js
  4. 4
      test/unit/sanitiser/suggest.js

1
query/indeces.js

@ -9,5 +9,6 @@ module.exports = [
'admin1', 'admin1',
'admin2', 'admin2',
'neighborhood', 'neighborhood',
'osmaddress',
'openaddresses' 'openaddresses'
]; ];

2
sanitiser/_layers.js

@ -50,7 +50,7 @@ function sanitize( req ){
layers = expand_aliases('poi', layers, ['geoname','osmnode','osmway']); layers = expand_aliases('poi', layers, ['geoname','osmnode','osmway']);
layers = expand_aliases('admin', layers, ['admin0','admin1','admin2','neighborhood']); layers = expand_aliases('admin', layers, ['admin0','admin1','admin2','neighborhood']);
layers = expand_aliases('address', layers, ['openaddresses']); layers = expand_aliases('address', layers, ['osmaddress','openaddresses']);
// de-dupe // de-dupe
layers = layers.filter(function(item, pos) { layers = layers.filter(function(item, pos) {

2
test/unit/query/indeces.js

@ -6,7 +6,7 @@ module.exports.tests = {};
module.exports.tests.interface = function(test, common) { module.exports.tests.interface = function(test, common) {
test('valid interface', function(t) { test('valid interface', function(t) {
t.true(Array.isArray(indeces), 'valid array'); t.true(Array.isArray(indeces), 'valid array');
t.equal(indeces.length, 8, 'valid array'); t.equal(indeces.length, 9, 'valid array');
t.end(); t.end();
}); });
}; };

4
test/unit/sanitiser/suggest.js

@ -181,7 +181,7 @@ module.exports.tests.sanitize_layers = function(test, common) {
}); });
}); });
test('address (alias) layer', function(t) { test('address (alias) layer', function(t) {
var address_layers = ['openaddresses']; var address_layers = ['osmaddress','openaddresses'];
sanitize({ layers: 'address', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ sanitize({ layers: 'address', input: 'test', lat: 0, lon: 0 }, function( err, clean ){
t.deepEqual(clean.layers, address_layers, 'address layers set'); t.deepEqual(clean.layers, address_layers, 'address layers set');
t.end(); t.end();
@ -204,7 +204,7 @@ module.exports.tests.sanitize_layers = function(test, common) {
}); });
}); });
test('address alias layer plus regular layers', function(t) { test('address alias layer plus regular layers', function(t) {
var address_layers = ['openaddresses']; var address_layers = ['osmaddress','openaddresses'];
var reg_layers = ['geoname', 'osmway']; var reg_layers = ['geoname', 'osmway'];
sanitize({ layers: 'address,geoname,osmway', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ sanitize({ layers: 'address,geoname,osmway', input: 'test', lat: 0, lon: 0 }, function( err, clean ){
t.deepEqual(clean.layers, reg_layers.concat(address_layers), 'address + regular layers set'); t.deepEqual(clean.layers, reg_layers.concat(address_layers), 'address + regular layers set');

Loading…
Cancel
Save