Skip to content

Commit

Permalink
feat(monaco): add support for microstate Monaco
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxit committed Oct 7, 2022
1 parent e60f6b1 commit e3bb3d4
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
6 changes: 6 additions & 0 deletions labelSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ module.exports = {
'country': getFRACountryValue()
}
},
'MCO': {
'valueFunctions': {
'local': getFirstProperty(['neighbourhood']),
'country': getFirstProperty(['country'])
}
},
'ITA': {
'valueFunctions': {
'local': getFirstProperty(['locality', 'localadmin']),
Expand Down
107 changes: 107 additions & 0 deletions test/labelGenerator_MCO.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
var generator = require('../labelGenerator');

module.exports.tests = {};

module.exports.tests.interface = function(test, common) {
test('interface', function(t) {
t.equal(typeof generator, 'function', 'valid function');
t.end();
});
};

module.exports.tests.monaco = function(test, common) {
test('venue', function(t) {
var doc = {
'name': { 'default': 'venue name' },
'layer': 'venue',
'housenumber': 'house number',
'street': 'street name',
'neighbourhood': ['neighbourhood name'],
'locality': ['locality name'],
'localadmin': ['localadmin name'],
'county': ['county name'],
'macrocounty': ['macrocounty name'],
'region': ['region name'],
'macroregion': ['macroregion name'],
'country_a': ['MCO'],
'country': ['Monaco']
};
t.equal(generator(doc),'venue name, neighbourhood name, Monaco');
t.end();
});

test('street', function(t) {
var doc = {
'name': { 'default': 'house number street name' },
'layer': 'address',
'housenumber': 'house number',
'street': 'street name',
'neighbourhood': ['neighbourhood name'],
'locality': ['locality name'],
'localadmin': ['localadmin name'],
'county': ['county name'],
'macrocounty': ['macrocounty name'],
'region': ['region name'],
'macroregion': ['macroregion name'],
'country_a': ['MCO'],
'country': ['Monaco']
};
t.equal(generator(doc),'house number street name, neighbourhood name, Monaco');
t.end();
});

test('neighbourhood', function(t) {
var doc = {
'name': { 'default': 'neighbourhood name' },
'layer': 'neighbourhood',
'neighbourhood': ['neighbourhood name'],
'locality': ['locality name'],
'localadmin': ['localadmin name'],
'county': ['county name'],
'macrocounty': ['macrocounty name'],
'region': ['region name'],
'macroregion': ['macroregion name'],
'country_a': ['MCO'],
'country': ['Monaco']
};
t.equal(generator(doc),'neighbourhood name, Monaco');
t.end();
});

test('region', function(t) {
var doc = {
'name': { 'default': 'Monaco' },
'layer': 'region',
'region': ['Monaco'],
'macroregion': ['macroregion name'],
'country_a': ['MCO'],
'country': ['Monaco']
};
t.equal(generator(doc),'Monaco');
t.end();
});

test('country', function(t) {
var doc = {
'name': { 'default': 'Monaco' },
'layer': 'country',
'postalcode': 'postalcode',
'country_a': ['MCO'],
'country': ['Monaco']
};
t.equal(generator(doc),'Monaco');
t.end();
});

};

module.exports.all = function (tape, common) {

function test(name, testFunction) {
return tape('label generator (FRA): ' + name, testFunction);
}

for( var testCase in module.exports.tests ){
module.exports.tests[testCase](test, common);
}
};
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var tests = [
require ('./labelGenerator_JPN'),
require ('./labelGenerator_JPN_JPN'),
require ('./labelGenerator_FRA'),
require ('./labelGenerator_MCO'),
require ('./getSchema'),
require ('./labelSchema')
];
Expand Down

0 comments on commit e3bb3d4

Please sign in to comment.