Skip to content

Commit

Permalink
Merge pull request pelias#45 from pelias/singapore-address-format
Browse files Browse the repository at this point in the history
Add Singapore schema without region or country
  • Loading branch information
orangejulius authored Feb 10, 2021
2 parents 7b26f4e + f4b9af9 commit be67d51
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
8 changes: 7 additions & 1 deletion labelSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,11 @@ module.exports = {
'regional': getRegionalValue,
'country': getFirstProperty(['country'])
}
}
},
'SGP': {
'valueFunctions': {
'local': getFirstProperty(['microhood', 'neighbourhood']),
'country': getFirstProperty(['country'])
}
},
};
28 changes: 28 additions & 0 deletions test/labelGenerator_examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,34 @@ module.exports.tests.france = function(test, common) {
t.end();
});

test('National Gallery Singapore - WOF data format as of Feb. 2021', function(t) {
const doc = {
'name': { 'default': 'National Gallery Singapore'},
'layer': 'venue',
'locality': ['Singapore'],
'region': ['Central Singapore'],
'region_a': ['CS'],
'country_a': ['SGP'],
'country': ['Singapore']
};
t.equal(generator(doc),'National Gallery Singapore, Singapore');
t.end();
});

test('Universal Studios Singapore- glorious future WOF data structure', function(t) {
const doc = {
'name': { 'default': 'Universal Studios Singapore'},
'layer': 'venue',
'neighbourhood': ['Sentosa'],
'locality': ['Singapore'],
'region': ['Central Singapore'],
'region_a': ['CS'],
'country_a': ['SGP'],
'country': ['Singapore']
};
t.equal(generator(doc),'Universal Studios Singapore, Sentosa, Singapore');
t.end();
});
};
module.exports.tests.italy = function(test, common) {
test('Italian street address', function(t) {
Expand Down
1 change: 0 additions & 1 deletion test/labelSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports.tests.supported_countries = function(test, common) {
t.notEquals(supported_countries.indexOf('FRA'), -1);
t.notEquals(supported_countries.indexOf('ITA'), -1);
t.notEquals(supported_countries.indexOf('default'), -1);
t.equals(supported_countries.length, 8);

t.equals(Object.keys(schemas.USA.valueFunctions).length, 4);
t.equals(Object.keys(schemas.CAN.valueFunctions).length, 3);
Expand Down

0 comments on commit be67d51

Please sign in to comment.