Skip to content

Commit 742125e

Browse files
committed
fix jest test
1 parent 756af5d commit 742125e

File tree

1 file changed

+9
-100
lines changed

1 file changed

+9
-100
lines changed

x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.test.js

Lines changed: 9 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,9 @@ describe('pluckStyleMetaFromSourceDataRequest', () => {
159159
const vectorStyle = new VectorStyle({}, new MockSource());
160160

161161
const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest);
162-
expect(featuresMeta.hasFeatureType).toEqual({
163-
LINE: false,
164-
POINT: true,
165-
POLYGON: false,
166-
});
162+
expect(featuresMeta.isPointsOnly).toBe(true);
163+
expect(featuresMeta.isLinesOnly).toBe(false);
164+
expect(featuresMeta.isPolygonsOnly).toBe(false);
167165
});
168166

169167
it('Should identify when feature collection only contains lines', async () => {
@@ -189,11 +187,9 @@ describe('pluckStyleMetaFromSourceDataRequest', () => {
189187
const vectorStyle = new VectorStyle({}, new MockSource());
190188

191189
const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest);
192-
expect(featuresMeta.hasFeatureType).toEqual({
193-
LINE: true,
194-
POINT: false,
195-
POLYGON: false,
196-
});
190+
expect(featuresMeta.isPointsOnly).toBe(false);
191+
expect(featuresMeta.isLinesOnly).toBe(true);
192+
expect(featuresMeta.isPolygonsOnly).toBe(false);
197193
});
198194
});
199195

@@ -241,11 +237,9 @@ describe('pluckStyleMetaFromSourceDataRequest', () => {
241237
);
242238

243239
const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest);
244-
expect(featuresMeta.hasFeatureType).toEqual({
245-
LINE: false,
246-
POINT: true,
247-
POLYGON: false,
248-
});
240+
expect(featuresMeta.isPointsOnly).toBe(true);
241+
expect(featuresMeta.isLinesOnly).toBe(false);
242+
expect(featuresMeta.isPolygonsOnly).toBe(false);
249243
});
250244

251245
it('Should extract scaled field range', async () => {
@@ -275,88 +269,3 @@ describe('pluckStyleMetaFromSourceDataRequest', () => {
275269
});
276270
});
277271
});
278-
279-
describe('checkIfOnlyFeatureType', () => {
280-
describe('source supports single feature type', () => {
281-
it('isPointsOnly should be true when source feature type only supports points', async () => {
282-
const vectorStyle = new VectorStyle(
283-
{},
284-
new MockSource({
285-
supportedShapeTypes: [VECTOR_SHAPE_TYPES.POINT],
286-
})
287-
);
288-
const isPointsOnly = await vectorStyle._getIsPointsOnly();
289-
expect(isPointsOnly).toBe(true);
290-
});
291-
292-
it('isLineOnly should be false when source feature type only supports points', async () => {
293-
const vectorStyle = new VectorStyle(
294-
{},
295-
new MockSource({
296-
supportedShapeTypes: [VECTOR_SHAPE_TYPES.POINT],
297-
})
298-
);
299-
const isLineOnly = await vectorStyle._getIsLinesOnly();
300-
expect(isLineOnly).toBe(false);
301-
});
302-
});
303-
304-
describe('source supports multiple feature types', () => {
305-
it('isPointsOnly should be true when data contains just points', async () => {
306-
const vectorStyle = new VectorStyle(
307-
{
308-
__styleMeta: {
309-
hasFeatureType: {
310-
POINT: true,
311-
LINE: false,
312-
POLYGON: false,
313-
},
314-
},
315-
},
316-
new MockSource({
317-
supportedShapeTypes: Object.values(VECTOR_SHAPE_TYPES),
318-
})
319-
);
320-
const isPointsOnly = await vectorStyle._getIsPointsOnly();
321-
expect(isPointsOnly).toBe(true);
322-
});
323-
324-
it('isPointsOnly should be false when data contains just lines', async () => {
325-
const vectorStyle = new VectorStyle(
326-
{
327-
__styleMeta: {
328-
hasFeatureType: {
329-
POINT: false,
330-
LINE: true,
331-
POLYGON: false,
332-
},
333-
},
334-
},
335-
new MockSource({
336-
supportedShapeTypes: Object.values(VECTOR_SHAPE_TYPES),
337-
})
338-
);
339-
const isPointsOnly = await vectorStyle._getIsPointsOnly();
340-
expect(isPointsOnly).toBe(false);
341-
});
342-
343-
it('isPointsOnly should be false when data contains points, lines, and polygons', async () => {
344-
const vectorStyle = new VectorStyle(
345-
{
346-
__styleMeta: {
347-
hasFeatureType: {
348-
POINT: true,
349-
LINE: true,
350-
POLYGON: true,
351-
},
352-
},
353-
},
354-
new MockSource({
355-
supportedShapeTypes: Object.values(VECTOR_SHAPE_TYPES),
356-
})
357-
);
358-
const isPointsOnly = await vectorStyle._getIsPointsOnly();
359-
expect(isPointsOnly).toBe(false);
360-
});
361-
});
362-
});

0 commit comments

Comments
 (0)