Skip to content

Commit

Permalink
Try this test
Browse files Browse the repository at this point in the history
  • Loading branch information
popkinj committed Nov 4, 2024
1 parent 2890da8 commit 8b8a0bd
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/data/feature_index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {FeatureIndex} from './feature_index';
import {OverscaledTileID} from '../source/tile_id';
import type {VectorTileFeature} from '@mapbox/vector-tile';
import {log} from 'console';

Check warning on line 4 in src/data/feature_index.test.ts

View workflow job for this annotation

GitHub Actions / Code Hygiene

'log' is defined but never used

describe('FeatureIndex', () => {
describe('getId', () => {
Expand Down Expand Up @@ -28,10 +29,10 @@ describe('FeatureIndex', () => {
test('uses cluster_id when cluster is true and id is undefined', () => {
const featureIndex = new FeatureIndex(tileID, 'someProperty');
const feature = {
id: 1,
properties: {
cluster: true,
cluster_id: '123',
promoteId: 'someProperty',
someProperty: undefined
},
geometry: {
Expand All @@ -46,27 +47,5 @@ describe('FeatureIndex', () => {

expect(featureIndex.getId(feature, 'sourceLayer')).toBe(123); // cluster_id converted to number
});

test('ignores cluster_id when cluster is false', () => {
const featureIndex = new FeatureIndex(tileID, 'someProperty');
const feature = {
id: 1,
properties: {
cluster: false,
cluster_id: '123',
someProperty: undefined
},
geometry: {
type: 'Point',
coordinates: [0, 0]
},
extent: 4096,
type: 1,
loadGeometry: () => [],
toGeoJSON: () => ({})
} as unknown as VectorTileFeature;

expect(featureIndex.getId(feature, 'sourceLayer')).toBeUndefined();
});
});
});

0 comments on commit 8b8a0bd

Please sign in to comment.