FeatureCollections

Matchers. FeatureCollections

Source:
See:
A set of matchers related to validating FeatureCollection objects.

Methods

(static) toBeFeatureCollection(featureCollectionObject)

Source:
See:
Verifies an object is a valid GeoJSON FeatureCollection. This object requires a "type" member that must equal 'FeatureCollection', and a "features" member that contains either a valid GeoJSON Feature or an empty array. Foreign members are allowed with the exception of 'coordinates', 'geometries', 'geometry', or 'properties'. If present, bounding boxes must be valid.
Examples
const testFeatureCollection = {
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [102.0, 0.5]
        }
    },
    ...
    ]
}
 test('Object is valid GeoJSON Feature', () => {
    expect(testFeatureCollection).toBeFeatureCollection()
})
const multiPoint = {
    type: "MultiPoint",
    coordinates: [
        [101.0, 0.0],
        [102.0, 1.0]
    ]
}

test('Object is NOT valid GeoJSON Geometry Object', () => {
    expect(multiPoint).not.toBeFeatureCollection()
    expect(testFeatureCollection.features).not.toBeFeatureCollection()
})
Parameters:
Name Type Description
featureCollectionObject object any GeoJSON Feature object