Skip to content

Commit ed5e758

Browse files
committed
test: fix geojson_source test case
Fixes the test "modifying cluster properties with pending data" so that it reflects the latest behavior. In the latest `main` branch, data and cluster options are separatedly applied. Therefore, there are one more `sendAsync` calls.
1 parent e84b94b commit ed5e758

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/source/geojson_source.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ describe('GeoJSONSource.update', () => {
407407

408408
await sleep(0);
409409

410-
expect(spy).toHaveBeenCalledTimes(2);
410+
expect(spy).toHaveBeenCalledTimes(3);
411411
expect(spy.mock.calls[0][0].type).toBe(MessageType.loadData);
412412
expect(spy.mock.calls[0][0].data.cluster).toBe(false);
413413
expect(spy.mock.calls[0][0].data.data).toBe(sourceData1);
@@ -417,6 +417,11 @@ describe('GeoJSONSource.update', () => {
417417
expect(spy.mock.calls[1][0].data.superclusterOptions.maxZoom).toBe(16);
418418
expect(spy.mock.calls[1][0].data.data).toBe(sourceData2);
419419
expect(spy.mock.calls[1][0].data.dataDiff).toBeUndefined();
420+
expect(spy.mock.calls[2][0].data.cluster).toBe(true);
421+
expect(spy.mock.calls[2][0].data.superclusterOptions.radius).toBe(80 * EXTENT / source.tileSize);
422+
expect(spy.mock.calls[2][0].data.superclusterOptions.maxZoom).toBe(16);
423+
expect(spy.mock.calls[2][0].data.data).toBeUndefined();
424+
expect(spy.mock.calls[2][0].data.dataDiff).toBeUndefined();
420425
});
421426

422427
test('modifying cluster properties after sending a diff', async () => {

0 commit comments

Comments
 (0)