Browse Source

adding a 'national' key to the outputSchema. fixing tests

output-generator-tweaks
Harish Krishna 10 years ago
parent
commit
2c67eb89c8
  1. 11
      helper/outputSchema.json
  2. 4
      test/unit/controller/doc.js
  3. 4
      test/unit/controller/search.js
  4. 4
      test/unit/controller/suggest.js
  5. 6
      test/unit/helper/geojsonify.js
  6. 5
      test/unit/helper/outputSchema.js

11
helper/outputSchema.json

@ -1,14 +1,17 @@
{
"USA": {
"local": ["local_admin", "locality", "neighborhood", "admin2"],
"regional": ["admin1_abbr", "admin1", "admin0"]
"regional": ["admin1_abbr", "admin1"],
"national": ["alpha3", "admin0"]
},
"GBR": {
"local": ["neighborhood", "admin2", "local_admin", "locality"],
"regional": ["admin2","admin0","admin1"]
"local": ["neighborhood", "local_admin", "locality"],
"regional": ["admin2", "admin1"],
"national": ["admin0", "alpha3"]
},
"default": {
"local": ["local_admin", "locality", "neighborhood", "admin2"],
"regional": ["admin1_abbr", "admin1", "admin0"]
"regional": ["admin1_abbr", "admin1"],
"national": ["admin0", "alpha3"]
}
}

4
test/unit/controller/doc.js

@ -29,7 +29,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country1',
admin1: 'state1',
admin2: 'city1',
text: 'test name1, city1, state1'
text: 'test name1, city1, state1, country1'
}
}, {
type: 'Feature',
@ -44,7 +44,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country2',
admin1: 'state2',
admin2: 'city2',
text: 'test name2, city2, state2'
text: 'test name2, city2, state2, country2'
}
}];

4
test/unit/controller/search.js

@ -30,7 +30,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country1',
admin1: 'state1',
admin2: 'city1',
text: 'test name1, city1, state1'
text: 'test name1, city1, state1, country1'
}
}, {
type: 'Feature',
@ -45,7 +45,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country2',
admin1: 'state2',
admin2: 'city2',
text: 'test name2, city2, state2'
text: 'test name2, city2, state2, country2'
}
}];

4
test/unit/controller/suggest.js

@ -30,7 +30,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country1',
admin1: 'state1',
admin2: 'city1',
text: 'test name1, city1, state1'
text: 'test name1, city1, state1, country1'
}
}, {
type: 'Feature',
@ -45,7 +45,7 @@ module.exports.tests.functional_success = function(test, common) {
admin0: 'country2',
admin1: 'state2',
admin2: 'city2',
text: 'test name2, city2, state2'
text: 'test name2, city2, state2, country2'
}
}];

6
test/unit/helper/geojsonify.js

@ -115,7 +115,7 @@ module.exports.tests.search = function(test, common) {
'properties': {
'id': 'id1',
'layer': 'type1',
'text': '\'Round Midnight Jazz and Blues Bar, test3, Angel',
'text': '\'Round Midnight Jazz and Blues Bar, test3, Angel, United Kingdom',
'name': '\'Round Midnight Jazz and Blues Bar',
'alpha3': 'GBR',
'admin0': 'United Kingdom',
@ -139,7 +139,7 @@ module.exports.tests.search = function(test, common) {
'properties': {
'id': 'id2',
'layer': 'type2',
'text': 'Blues Cafe, test3, Smithfield',
'text': 'Blues Cafe, test3, Smithfield, United Kingdom',
'name': 'Blues Cafe',
'alpha3': 'GBR',
'admin0': 'United Kingdom',
@ -163,7 +163,7 @@ module.exports.tests.search = function(test, common) {
'properties': {
'id': '34633854',
'layer': 'osmway',
'text': 'Empire State Building, Manhattan, NY',
'text': 'Empire State Building, Manhattan, NY, USA',
'name': 'Empire State Building',
'alpha3': 'USA',
'admin0': 'United States',

5
test/unit/helper/outputSchema.js

@ -13,10 +13,11 @@ module.exports.tests.interface = function(test, common) {
};
module.exports.tests.valid = function(test, common) {
var valid_keys = ['local_admin', 'locality', 'neighborhood', 'admin2', 'admin1_abbr', 'admin1', 'admin0'];
var valid_keys = ['local_admin', 'locality', 'neighborhood', 'admin2', 'admin1_abbr', 'admin1', 'admin0', 'alpha3'];
var default_schema = {
local: ['local_admin', 'locality', 'neighborhood', 'admin2'],
regional: ['admin1_abbr', 'admin1', 'admin0']
regional: ['admin1_abbr', 'admin1'],
national: ['admin0', 'alpha3']
};
var isValid = function(keys, schema) {

Loading…
Cancel
Save