Skip to content

Commit d9ea5f7

Browse files
committed
Test that returned features have a numeric area property
1 parent 9752916 commit d9ea5f7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/locationToFeature.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ test('locationToFeature', t => {
99
let result = oci.locationToFeature([0, 0]);
1010
t.notEqual(result, null);
1111
t.equal(result.type, 'point');
12+
t.type(result.feature, 'object');
13+
t.type(result.feature.properties, 'object');
14+
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
1215
t.end();
1316
});
1417
t.test('an invalid [lon,lat] coordinate pair returns a null match', t => {
@@ -25,6 +28,9 @@ test('locationToFeature', t => {
2528
let result = oci.locationToFeature('philly_metro.geojson', oci.features);
2629
t.notEqual(result, null);
2730
t.equal(result.type, 'geojson');
31+
t.type(result.feature, 'object');
32+
t.type(result.feature.properties, 'object');
33+
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
2834
t.end();
2935
});
3036
t.test('an invalid `.geojson` filename in this project returns a null match', t => {
@@ -41,6 +47,9 @@ test('locationToFeature', t => {
4147
let result = oci.locationToFeature('gb');
4248
t.notEqual(result, null);
4349
t.equal(result.type, 'countrycoder');
50+
t.type(result.feature, 'object');
51+
t.type(result.feature.properties, 'object');
52+
t.match(result.feature.properties, { area: /\d+/ }); // has a numeric area property
4453
t.end();
4554
});
4655
t.test('an invalid country coder feature identifier returns a null match', t => {

0 commit comments

Comments
 (0)