Skip to content

Commit

Permalink
Test that returned features have a numeric area property
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel committed Nov 18, 2019
1 parent 9752916 commit d9ea5f7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/locationToFeature.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ test('locationToFeature', t => {
let result = oci.locationToFeature([0, 0]);
t.notEqual(result, null);
t.equal(result.type, 'point');
t.type(result.feature, 'object');
t.type(result.feature.properties, 'object');
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
t.end();
});
t.test('an invalid [lon,lat] coordinate pair returns a null match', t => {
Expand All @@ -25,6 +28,9 @@ test('locationToFeature', t => {
let result = oci.locationToFeature('philly_metro.geojson', oci.features);
t.notEqual(result, null);
t.equal(result.type, 'geojson');
t.type(result.feature, 'object');
t.type(result.feature.properties, 'object');
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
t.end();
});
t.test('an invalid `.geojson` filename in this project returns a null match', t => {
Expand All @@ -41,6 +47,9 @@ test('locationToFeature', t => {
let result = oci.locationToFeature('gb');
t.notEqual(result, null);
t.equal(result.type, 'countrycoder');
t.type(result.feature, 'object');
t.type(result.feature.properties, 'object');
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
t.end();
});
t.test('an invalid country coder feature identifier returns a null match', t => {
Expand Down

0 comments on commit d9ea5f7

Please sign in to comment.