Browse Source

Fix helper unit tests

pull/426/head
Diana Shkolnikov 9 years ago committed by Julian Simioni
parent
commit
3daec67b6b
  1. 6
      test/unit/helper/labelGenerator_GBR.js
  2. 24
      test/unit/helper/labelGenerator_USA.js
  3. 32
      test/unit/helper/labelGenerator_default.js
  4. 3
      test/unit/helper/type_mapping.js

6
test/unit/helper/labelGenerator_GBR.js

@ -14,7 +14,7 @@ module.exports.tests.interface = function(test, common) {
module.exports.tests.one_main_street_uk = function(test, common) {
test('one main street uk', function(t) {
var doc = {
'name': { 'default': '1 Main St' },
'name': '1 Main St',
'housenumber': '1',
'street': 'Main St',
'postalcode': 'BT77 0BG',
@ -31,7 +31,7 @@ module.exports.tests.one_main_street_uk = function(test, common) {
module.exports.tests.hackney_city_farm = function(test, common) {
test('hackney city farm', function(t) {
var doc = {
'name': { 'default': 'Hackney City Farm' },
'name': 'Hackney City Farm',
'country_a': 'GBR',
'country': 'United Kingdom',
'region': 'Hackney',
@ -48,7 +48,7 @@ module.exports.tests.hackney_city_farm = function(test, common) {
module.exports.tests.wales = function(test, common) {
test('wales', function(t) {
var doc = {
'name': { 'default': 'Wales' },
'name': 'Wales',
'country_a': 'GBR',
'country': 'United Kingdom',
'region': 'Wales'

24
test/unit/helper/labelGenerator_USA.js

@ -12,7 +12,7 @@ module.exports.tests.interface = function(test, common) {
module.exports.tests.localadmin = function(test, common) {
test('localadmin should trump locality, neighbourhood, and county', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -30,7 +30,7 @@ module.exports.tests.localadmin = function(test, common) {
module.exports.tests.locality = function(test, common) {
test('locality should trump neighbourhood and county when localadmin not available', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -47,7 +47,7 @@ module.exports.tests.locality = function(test, common) {
module.exports.tests.neighbourhood = function(test, common) {
test('neighbourhood should trump county when neither localadmin nor locality', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -63,7 +63,7 @@ module.exports.tests.neighbourhood = function(test, common) {
module.exports.tests.county = function(test, common) {
test('county should be used when localadmin, locality, and neighbourhood are not available', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -78,7 +78,7 @@ module.exports.tests.county = function(test, common) {
module.exports.tests.region = function(test, common) {
test('region should be used when region_a is not available', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name'
@ -92,7 +92,7 @@ module.exports.tests.region = function(test, common) {
module.exports.tests.region_geonames = function(test, common) {
test('default name should not be prepended when source=geonames and layer=region', function(t) {
var doc = {
'name': { 'default': 'Region Name' },
'name': 'Region Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -109,7 +109,7 @@ module.exports.tests.region_geonames = function(test, common) {
module.exports.tests.region_whosonfirst = function(test, common) {
test('default name should not be prepended when source=whosonfirst and layer=region', function(t) {
var doc = {
'name': { 'default': 'Region Name' },
'name': 'Region Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -126,7 +126,7 @@ module.exports.tests.region_whosonfirst = function(test, common) {
module.exports.tests.region_other_source = function(test, common) {
test('default name should be prepended when layer=region and source is not whosonfirst or geonames', function(t) {
var doc = {
'name': { 'default': 'Default Name' },
'name': 'Default Name',
'country_a': 'USA',
'country': 'United States',
'region': 'Region Name',
@ -143,7 +143,7 @@ module.exports.tests.region_other_source = function(test, common) {
module.exports.tests.san_francisco = function(test, common) {
test('san francisco', function(t) {
var doc = {
'name': { 'default': 'San Francisco' },
'name': 'San Francisco',
'country_a': 'USA',
'country': 'United States',
'region': 'California',
@ -160,7 +160,7 @@ module.exports.tests.san_francisco = function(test, common) {
module.exports.tests.nyc_office = function(test, common) {
test('30 West 26th Street', function(t) {
var doc = {
'name': { 'default': '30 West 26th Street' },
'name': '30 West 26th Street',
'housenumber': '30',
'street': 'West 26th Street',
'postalcode': '10010',
@ -182,7 +182,7 @@ module.exports.tests.nyc_office = function(test, common) {
module.exports.tests.nyc_bakery = function(test, common) {
test('New York Bakery', function(t) {
var doc = {
'name': { 'default': 'New York Bakery' },
'name': 'New York Bakery',
'housenumber': '51 W',
'street': '29th',
'country_a': 'USA',
@ -203,7 +203,7 @@ module.exports.tests.nyc_bakery = function(test, common) {
module.exports.tests.ferry_building = function(test, common) {
test('Ferry Building', function(t) {
var doc = {
'name': { 'default': 'Ferry Building' },
'name': 'Ferry Building',
'country_a': 'USA',
'country': 'United States',
'region': 'California',

32
test/unit/helper/labelGenerator_default.js

@ -14,7 +14,7 @@ module.exports.tests.interface = function(test, common) {
module.exports.tests.new_south_wales = function(test, common) {
test('new south wales', function(t) {
var doc = {
'name': { 'default': 'New South Wales' },
'name': 'New South Wales',
'country_a': 'AUS',
'country': 'Australia',
'region': 'New South Wales'
@ -28,7 +28,7 @@ module.exports.tests.new_south_wales = function(test, common) {
module.exports.tests.west_bengal = function(test, common) {
test('west bengal', function(t) {
var doc = {
'name': { 'default': 'West Bengal' },
'name': 'West Bengal',
'country_a': 'IND',
'country': 'India',
'region': 'West Bengal'
@ -42,7 +42,7 @@ module.exports.tests.west_bengal = function(test, common) {
module.exports.tests.bangalore = function(test, common) {
test('bangalore', function(t) {
var doc = {
'name': { 'default': 'Bangalore' },
'name': 'Bangalore',
'country_a': 'IND',
'country': 'India',
'region': 'Karnataka',
@ -58,7 +58,7 @@ module.exports.tests.bangalore = function(test, common) {
module.exports.tests.sarjapur = function(test, common) {
test('Sarjapur', function(t) {
var doc = {
'name': { 'default': 'Sarjapur' },
'name': 'Sarjapur',
'country_a': 'IND',
'country': 'India',
'region': 'Karnataka'
@ -72,7 +72,7 @@ module.exports.tests.sarjapur = function(test, common) {
module.exports.tests.bengaluru_east = function(test, common) {
test('Bengaluru East', function(t) {
var doc = {
'name': { 'default': 'Bengaluru East' },
'name': 'Bengaluru East',
'country_a': 'IND',
'country': 'India',
'region': 'Karnataka',
@ -90,7 +90,7 @@ module.exports.tests.bengaluru_east = function(test, common) {
module.exports.tests.wellington_victoria = function(test, common) {
test('Wellington, Victoria, Australia', function(t) {
var doc = {
'name': { 'default': 'Wellington' },
'name': 'Wellington',
'country_a': 'AUS',
'country': 'Australia',
'region': 'Victoria',
@ -105,7 +105,7 @@ module.exports.tests.wellington_victoria = function(test, common) {
module.exports.tests.arbil = function(test, common) {
test('arbil', function(t) {
var doc = {
'name': { 'default': 'Arbil' },
'name': 'Arbil',
'country_a': 'IRQ',
'country': 'Iraq',
'region': 'Arbil'
@ -119,7 +119,7 @@ module.exports.tests.arbil = function(test, common) {
module.exports.tests.madrid = function(test, common) {
test('madrid', function(t) {
var doc = {
'name': { 'default': 'Madrid' },
'name': 'Madrid',
'country_a': 'ESP',
'country': 'Spain',
'region': 'Madrid'
@ -133,7 +133,7 @@ module.exports.tests.madrid = function(test, common) {
module.exports.tests.one_grolmanstrasse = function(test, common) {
test('one grolmanstrasse', function(t) {
var doc = {
'name': { 'default': '1 GrolmanstraĂźe' },
'name': '1 GrolmanstraĂźe',
'housenumber': '1',
'street': 'GrolmanstraĂźe',
'postalcode': '10623',
@ -153,7 +153,7 @@ module.exports.tests.one_grolmanstrasse = function(test, common) {
module.exports.tests.new_zealand = function(test, common) {
test('new zealand', function(t) {
var doc = {
'name': { 'default': 'New Zealand' },
'name': 'New Zealand',
'country_a': 'NZL',
'country': 'New Zealand'
};
@ -166,7 +166,7 @@ module.exports.tests.new_zealand = function(test, common) {
module.exports.tests.republic_of_ireland = function(test, common) {
test('northern ireland', function(t) {
var doc = {
'name': { 'default': 'Ireland' },
'name': 'Ireland',
'country_a': 'IRL',
'country': 'Ireland'
};
@ -180,7 +180,7 @@ module.exports.tests.republic_of_ireland = function(test, common) {
module.exports.tests.krabi_province = function(test, common) {
test('Krabi Provence', function(t) {
var doc = {
'name': { 'default': 'Krabi' },
'name': 'Krabi',
'country_a': 'THA',
'country': 'Thailand',
'region': 'Krabi'
@ -194,7 +194,7 @@ module.exports.tests.krabi_province = function(test, common) {
module.exports.tests.koh_lanta = function(test, common) {
test('Koh Lanta', function(t) {
var doc = {
'name': { 'default': 'Ko Lanta' },
'name': 'Ko Lanta',
'country_a': 'THA',
'country': 'Thailand',
'region': 'Krabi'
@ -208,7 +208,7 @@ module.exports.tests.koh_lanta = function(test, common) {
module.exports.tests.black_dog_cafe = function(test, common) {
test('Black Dog Cafe', function(t) {
var doc = {
'name': { 'default': 'Black Dog Cafe' },
'name': 'Black Dog Cafe',
'country_a': 'NZL',
'country': 'New Zealand',
'region': 'Auckland Region',
@ -223,7 +223,7 @@ module.exports.tests.black_dog_cafe = function(test, common) {
module.exports.tests.beach_bablyon = function(test, common) {
test('Beach Bablyon', function(t) {
var doc = {
'name': { 'default': 'Beach Bablyon' },
'name': 'Beach Bablyon',
'country_a': 'NZL',
'country': 'New Zealand',
'region': 'Wellington Region',
@ -240,7 +240,7 @@ module.exports.tests.beach_bablyon = function(test, common) {
module.exports.tests.waiotapu = function(test, common) {
test('Waiotapu', function(t) {
var doc = {
'name': { 'default': 'Waiotapu' },
'name': 'Waiotapu',
'country_a': 'NZL',
'country': 'New Zealand',
'region': 'Bay of Plenty',

3
test/unit/helper/type_mapping.js

@ -14,8 +14,7 @@ module.exports.tests.interfaces = function(test, common) {
t.deepEquals(type_mapping.layer_mapping.coarse,
[ 'continent', 'macrocountry', 'country', 'dependency',
'region', 'locality', 'localadmin', 'county', 'macrohood',
'neighbourhood', 'microhood', 'disputed', 'admin0',
'admin1', 'admin2', 'neighborhood', 'locality', 'local_admin']);
'neighbourhood', 'microhood', 'disputed' ]);
t.end();
});

Loading…
Cancel
Save