mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix: allocate share-link layer tokens without collisions
This commit is contained in:
1 parent
ce671ce500
commit
54735a9e6f
15 files changed
+1295
-20
No files matched your search
@@ -78,6 +78,23 @@ test('unknown-only v2 layer tokens are invalid, while historical l fields stay i
|
||||
}
|
||||
});
|
||||
|
||||
test('malformed v2 layer lists mark the whole incoming share payload invalid', () => {
|
||||
for (const layers of ['.f', 'f.', 'f..c', 'f.f']) {
|
||||
const parsed = makeManager(
|
||||
`#v=2&lat=10&lon=20&l=${layers}`,
|
||||
).parseInitialHash();
|
||||
assert.equal(parsed.layerState, null, `l=${layers}`);
|
||||
assert.equal(parsed.layerStateInvalid, true, `l=${layers}`);
|
||||
}
|
||||
for (const layers of ['l=f&l=f', 'l=f&l=unknown', 'l=&l=f']) {
|
||||
const parsed = makeManager(
|
||||
`#v=2&lat=10&lon=20&${layers}`,
|
||||
).parseInitialHash();
|
||||
assert.equal(parsed.layerState, null, layers);
|
||||
assert.equal(parsed.layerStateInvalid, true, layers);
|
||||
}
|
||||
});
|
||||
|
||||
test('Nepal locator token is valid in v2 share links', () => {
|
||||
const parsed = makeManager('#v=2&lat=10&lon=20&l=z').parseInitialHash();
|
||||
assert.deepEqual(parsed.layerState.enabledLayerIds, ['bhote-koshi-locator']);
|
||||
|
||||
Reference in new issue
Block a user