From 9502ab8854f718dea0cc822cfd5b1998d68c61e5 Mon Sep 17 00:00:00 2001 From: Harish Krishna Date: Thu, 9 Apr 2015 10:59:11 -0400 Subject: [PATCH] fixing failing tests --- test/unit/sanitiser/reverse.js | 12 ++++++------ test/unit/sanitiser/search.js | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/unit/sanitiser/reverse.js b/test/unit/sanitiser/reverse.js index a6627273..3a06eaef 100644 --- a/test/unit/sanitiser/reverse.js +++ b/test/unit/sanitiser/reverse.js @@ -6,7 +6,7 @@ var suggest = require('../../../sanitiser/reverse'), defaultError = 'missing param \'lat\': must be >-90 and <90', defaultClean = { lat:0, layers: [ 'geoname', 'osmnode', 'osmway', 'admin0', 'admin1', 'admin2', 'neighborhood', - 'osmaddress', 'openaddresses' ], + 'locality', 'local_admin', 'osmaddress', 'openaddresses' ], lon: 0, size: 1 }, @@ -31,7 +31,7 @@ module.exports.tests.sanitize_lat = function(test, common) { var lats = { invalid: [ -181, -120, -91, 91, 120, 181 ], valid: [ 0, 45, 90, -0, '0', '45', '90' ], - missing: ['', undefined, ,null] + missing: ['', undefined, null] }; test('invalid lat', function(t) { lats.invalid.forEach( function( lat ){ @@ -68,7 +68,7 @@ module.exports.tests.sanitize_lon = function(test, common) { var lons = { invalid: [ -360, -181, 181, 360 ], valid: [ -180, -1, -0, 0, 45, 90, '-180', '0', '180' ], - missing: ['', undefined, ,null] + missing: ['', undefined, null] }; test('invalid lon', function(t) { lons.invalid.forEach( function( lon ){ @@ -147,7 +147,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin (alias) layer', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'admin', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, admin_layers, 'admin layers set'); t.end(); @@ -169,7 +169,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin alias layer plus regular layers', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; var reg_layers = ['geoname', 'osmway']; sanitize({ layers: 'admin,geoname,osmway', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, reg_layers.concat(admin_layers), 'admin + regular layers set'); @@ -192,7 +192,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('multiple alias layers (no duplicates)', function(t) { - var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood']; + var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'poi,admin', input: 'test', lat: 0, lon: 0 }, function( err, clean ){ t.deepEqual(clean.layers, alias_layers, 'all layers found (no duplicates)'); t.end(); diff --git a/test/unit/sanitiser/search.js b/test/unit/sanitiser/search.js index e685a442..edb8e7c8 100644 --- a/test/unit/sanitiser/search.js +++ b/test/unit/sanitiser/search.js @@ -6,7 +6,7 @@ var search = require('../../../sanitiser/search'), defaultError = 'invalid param \'input\': text length, must be >0', defaultClean = { input: 'test', layers: [ 'geoname', 'osmnode', 'osmway', 'admin0', 'admin1', 'admin2', 'neighborhood', - 'osmaddress', 'openaddresses' ], + 'locality', 'local_admin', 'osmaddress', 'openaddresses' ], size: 10 }, sanitize = function(query, cb) { _sanitize({'query':query}, cb); }; @@ -289,7 +289,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin (alias) layer', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'admin', input: 'test' }, function( err, clean ){ t.deepEqual(clean.layers, admin_layers, 'admin layers set'); t.end(); @@ -311,7 +311,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('admin alias layer plus regular layers', function(t) { - var admin_layers = ['admin0','admin1','admin2','neighborhood']; + var admin_layers = ['admin0','admin1','admin2','neighborhood','locality','local_admin']; var reg_layers = ['geoname', 'osmway']; sanitize({ layers: 'admin,geoname,osmway', input: 'test' }, function( err, clean ){ t.deepEqual(clean.layers, reg_layers.concat(admin_layers), 'admin + regular layers set'); @@ -334,7 +334,7 @@ module.exports.tests.sanitize_layers = function(test, common) { }); }); test('multiple alias layers (no duplicates)', function(t) { - var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood']; + var alias_layers = ['geoname','osmnode','osmway','admin0','admin1','admin2','neighborhood','locality','local_admin']; sanitize({ layers: 'poi,admin', input: 'test' }, function( err, clean ){ t.deepEqual(clean.layers, alias_layers, 'all layers found (no duplicates)'); t.end();