You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GeoJSON Features have an optional ID member that can be any string or number. This matcher verifies that all Features within a FeatureCollection contain IDs and that they are all type string.
If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of the Feature object with the name "id", and the value of this member is either a JSON string or number.
An "id" member on a non-feature object gets treated as a foreign member instead of an ID. Therefore, this matcher rejects non-FeatureCollection objects.
This test will fail if any of the IDs have a type number, do not have an ID, or if the "features" member is an empty array.
Description
GeoJSON Features have an optional ID member that can be any string or number. This matcher verifies that all Features within a FeatureCollection contain IDs and that they are all type
string
.An "id" member on a non-feature object gets treated as a foreign member instead of an ID. Therefore, this matcher rejects non-FeatureCollection objects.
This test will fail if any of the IDs have a type
number
, do not have an ID, or if the "features" member is an empty array.Example Matcher Usage
Passing Tests
Unique String IDs
Identical String IDs
Failing Tests
Invalid Inputs To Matcher
Rejects each of the following:
undefined
,null
,false
,true
,0
{ someProp: 'I am not GeoJSON', id: 4 }
''
,'Random Feature'
,Only Some Have String IDs, the Rest Null or Not Mentioned
null
FeatureCollection with Empty Features Array
Should fail because there are no features to check IDs on.
FeatureCollection with No ID
Should fail with a single feature that has no ID.
All Have Number IDs
Only Some Have Number IDs, the Rest String ID, Null, or Not Mentioned
The text was updated successfully, but these errors were encountered: