diff --git a/src/components/extractFields.js b/src/components/extractFields.js index 0aa1d0ee..b597a5d5 100644 --- a/src/components/extractFields.js +++ b/src/components/extractFields.js @@ -65,12 +65,8 @@ function getName(properties) { } } -function isDependencyOrCountry(placetype) { - return placetype === 'dependency' || placetype === 'country'; -} - function getAbbreviation(properties) { - if (isDependencyOrCountry(properties['wof:placetype']) && properties['wof:country']) { + if (properties['wof:placetype'] === 'country' && properties['wof:country']) { return properties['wof:country']; } return properties['wof:abbreviation']; diff --git a/test/components/extractFieldsTest.js b/test/components/extractFieldsTest.js index ca062900..2c657170 100644 --- a/test/components/extractFieldsTest.js +++ b/test/components/extractFieldsTest.js @@ -439,8 +439,8 @@ tape('readStreamComponents', function(test) { properties: { 'wof:name': 'wof:name value', 'wof:placetype': 'dependency', - 'wof:country': 'XY', - 'wof:abbreviation': 'YZ' + 'wof:country': 'value from wof:country', + 'wof:abbreviation': 'value from wof:abbreviation' } } ]; @@ -455,7 +455,7 @@ tape('readStreamComponents', function(test) { population: undefined, popularity: undefined, bounding_box: undefined, - abbreviation: 'XY', + abbreviation: 'value from wof:abbreviation', hierarchies: [] } ];