fix(outlines): harden shared cache and provider lifecycle

This commit is contained in:
manjunath22466 committed 2026-10-02 22:32:46 +05:30
1 parent 9559e7a282
commit 177b5951a0
27 files changed
+3363 -248

No files matched your search

+12 -2
View File
@@ -3,7 +3,10 @@ import test from 'node:test';
import { readFileSync } from 'node:fs';
import { tilesForBounds, tileToBBox } from '../../data/tomtomTiles.js';
import { decodeFlowTile } from './flowDecode.js';
import { decodeOpenFreeMapTile } from '../../sources/openFreeMap.js';
import {
clearSharedOpenFreeMapTiles,
decodeOpenFreeMapTile,
} from '../../sources/openFreeMap.js';
import {
RoadRequestError,
roadRequestError,
@@ -829,6 +832,8 @@ test('failed detail cores retain real coarse roads while successful cores replac
});
test('traffic separates API and public tile transports, including the default tile fetch', async (t) => {
clearSharedOpenFreeMapTiles();
t.after(clearSharedOpenFreeMapTiles);
const publicUrls = [],
apiUrls = [];
const publicFetch = async (url) => {
@@ -864,6 +869,11 @@ test('traffic separates API and public tile transports, including the default ti
(await (await source.requestOsmRoads(bounds)).json()).roads.length,
);
}
assert.ok(publicUrls.length >= 4);
assert.equal(
publicUrls.filter((url) => url.endsWith('.pbf')).length,
1,
'compatible sources reuse the shared decoded public tile',
);
assert.equal(publicUrls.filter((url) => url.endsWith('/planet')).length, 2);
assert.ok(apiUrls.length >= 4);
});