mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
9 years ago
|
|
||
|
var generator = require('../../../helper/labelGenerator');
|
||
|
|
||
|
module.exports.tests = {};
|
||
|
|
||
|
module.exports.tests.interface = function(test, common) {
|
||
|
test('interface', function(t) {
|
||
|
t.equal(typeof generator, 'function', 'valid function');
|
||
|
t.end();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
// SGP region
|
||
|
module.exports.tests.north_west_singapore = function(test, common) {
|
||
|
test('north west singapore', function(t) {
|
||
|
var doc = {
|
||
|
'name': { 'default': 'North West' },
|
||
|
'country_a': 'SGP',
|
||
|
'country': 'Singapore',
|
||
|
'region': 'North West'
|
||
|
};
|
||
|
t.equal(generator(doc),'North West, Singapore');
|
||
|
t.end();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
// SGP venue
|
||
|
module.exports.tests.singapore_mcdonalds = function(test, common) {
|
||
|
test('singapore_mcdonalds', function(t) {
|
||
|
var doc = {
|
||
|
'name': { 'default': 'McDonald\'s' },
|
||
|
'country_a': 'SGP',
|
||
|
'country': 'Singapore',
|
||
|
'region': 'Central Singapore',
|
||
|
'locality': 'Singapore'
|
||
|
};
|
||
|
t.equal(generator(doc),'McDonald\'s, Central Singapore, Singapore');
|
||
|
t.end();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports.all = function (tape, common) {
|
||
|
|
||
|
function test(name, testFunction) {
|
||
|
return tape('label generator: ' + name, testFunction);
|
||
|
}
|
||
|
|
||
|
for( var testCase in module.exports.tests ){
|
||
|
module.exports.tests[testCase](test, common);
|
||
|
}
|
||
|
};
|