test null geometry

This commit is contained in:
mike-000
2021-01-14 11:25:07 +00:00
committed by GitHub
parent 500814db3c
commit 50c99330e9

View File

@@ -48,6 +48,19 @@ const zeroId = {
},
};
const nullGeometry = {
type: 'Topology',
objects: {
foobar: {
type: null,
properties: {
prop0: 'value0',
},
id: 533,
},
},
};
describe('ol.format.TopoJSON', function () {
let format;
before(function () {
@@ -93,6 +106,17 @@ describe('ol.format.TopoJSON', function () {
expect(feature).to.be.a(Feature);
expect(feature.getId()).to.be(0);
});
it('can read a feature with null geometry', function () {
const features = format.readFeaturesFromObject(nullGeometry);
expect(features).to.have.length(1);
const feature = features[0];
expect(feature).to.be.a(Feature);
expect(feature.getGeometry()).to.be(null);
expect(feature.getId()).to.be(533);
expect(feature.get('prop0')).to.be('value0');
});
});
describe('#readFeatures()', function () {