feat: v0.4.1 — untrack map-asset pack (~100 MB): compose volume mount + runtime fallback to remote OFM styles

This commit is contained in:
2026-09-17 09:14:34 +00:00
parent 501c452377
commit 1c50cfeab2
791 changed files with 257 additions and 5171 deletions
+45
View File
@@ -214,3 +214,48 @@ test('style choice persists across reloads via localStorage', async ({ page }) =
await page.reload();
await expect(select).toHaveValue('positron');
});
test('falls back to remote OFM styles when the local asset pack is absent', async ({ page }) => {
// Simulates a fresh clone without the generated asset pack (no volume mount):
// the manifest probe gets a 404, so the app must load its style from
// openfreemap.org. Only style fetches are allowed through; all other OFM traffic
// (tiles/fonts/sprites) is aborted for speed — the GeoJSON airport layer needs none of it.
// Routes match in reverse declaration order: manifest 404 > styles continue > abort-all.
await page.route('**://*.openfreemap.org/**', (route) => route.abort());
await page.route('**://*.openfreemap.org/styles/**', (route) => route.continue());
await page.route('**/map-assets-manifest.json', (route) => route.fulfill({ status: 404 }));
await page.goto(APP_URL);
// The map must have been created from the REMOTE style — its glyphs still point at OFM.
const glyphs = () => page.evaluate(() => (window as any).__flightMap?.getStyle()?.glyphs ?? '');
await expect.poll(glyphs, { timeout: 15_000 }).toContain('tiles.openfreemap.org');
// The app is fully usable without the pack: airport count renders…
const count = await waitForAirportCount(page);
expect(count).toBeGreaterThan(0);
// …and markers are rendered and clickable.
await expect.poll(async () =>
page.evaluate(
() =>
(window as any).__flightMap?.queryRenderedFeatures(undefined, {
layers: ['airports-circles'],
})?.length ?? 0,
),
{ timeout: 15_000 },
).toBeGreaterThan(0);
const pt = await page.evaluate(() => {
const map = (window as any).__flightMap;
const p = map.project([30.894699, 50.345001]); // UKBB Boryspil
const rect = map.getContainer().getBoundingClientRect();
return { x: rect.left + p.x, y: rect.top + p.y };
});
await page.mouse.click(pt.x, pt.y);
const popup = page.getByTestId('airport-popup');
await expect(popup).toBeVisible();
await expect(popup).toContainText('Boryspil International Airport');
await expect(popup).toContainText('UKBB');
});