-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accounting for IDs of cluster features when the promoteID properties …
…is set (#4899) * Accounting for IDs of cluster features when the promoteID properties is set * feature collection for testing clusters * First crack at a test * sorta getting there but not really * Not sure why these are failing * This should be working * No logging please * Reverting back to before I accidentally changed the default linter * This is a better approach I think * These three tests are passing * These tests look good to go * updated changelog * Probably should keep this * Some updates from PR feedback * Try this test * Think I was trying to cover to much with this test * Don't need this anymore * Silly update to restart the pipeline
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {FeatureIndex} from './feature_index'; | ||
import {OverscaledTileID} from '../source/tile_id'; | ||
import type {VectorTileFeature} from '@mapbox/vector-tile'; | ||
|
||
describe('FeatureIndex', () => { | ||
describe('getId', () => { | ||
const tileID = new OverscaledTileID(0, 0, 0, 0, 0); | ||
|
||
test('uses cluster_id when cluster is true and id is undefined', () => { | ||
const featureIndex = new FeatureIndex(tileID, 'someProperty'); | ||
const feature = { | ||
properties: { | ||
cluster: true, | ||
cluster_id: '123', | ||
promoteId: 'someProperty', | ||
someProperty: undefined | ||
}, | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [0, 0] | ||
}, | ||
extent: 4096, | ||
type: 1, | ||
loadGeometry: () => [], | ||
toGeoJSON: () => ({}) | ||
} as unknown as VectorTileFeature; | ||
|
||
expect(featureIndex.getId(feature, 'sourceLayer')).toBe(123); // cluster_id converted to number | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters