test: fix stale trip-slug references; add home, highlights, a11y specs
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// @ts-check
|
||||
// Tests: G1–G5 — buildJourneySegments algorithm correctness
|
||||
// These tests load the italy-2025 map page (which has GPX) to get MapUtils in scope,
|
||||
// These tests load the italy-2026-demo map page (which has GPX) to get MapUtils in scope,
|
||||
// then call the functions with synthetic data via page.evaluate.
|
||||
// Requires demo data: run `make demo-load` before this suite.
|
||||
const { test, expect } = require('@playwright/test');
|
||||
|
||||
async function getMapUtils(page) {
|
||||
await page.goto('/trips/italy-2025/map');
|
||||
await page.goto('/trips/italy-2026-demo/map');
|
||||
await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ test('G1: all markers connected when no GPX files present', async ({ page }) =>
|
||||
{ lat: '44.0', lng: '12.0', force_connect: false },
|
||||
{ lat: '45.0', lng: '13.0', force_connect: false }
|
||||
];
|
||||
return MapUtils.buildJourneySegments(entries, [], 10).length;
|
||||
return MapUtils.buildJourneySegments(entries, { connectMode: 'intelligent_gpx' }, []).length;
|
||||
});
|
||||
|
||||
expect(count).toBe(1);
|
||||
@@ -35,7 +35,7 @@ test('G2: connector suppressed when same GPX file covers both markers', async ({
|
||||
var e2 = { lat: '43.010', lng: '11.010', force_connect: false };
|
||||
// Trackpoints covering both (stored as [lat, lng])
|
||||
var track = [[43.000, 11.000], [43.005, 11.005], [43.010, 11.010]];
|
||||
return MapUtils.buildJourneySegments([e1, e2], [track], 10).length;
|
||||
return MapUtils.buildJourneySegments([e1, e2], { connectMode: 'intelligent_gpx' }, [track]).length;
|
||||
});
|
||||
|
||||
expect(count).toBe(0);
|
||||
@@ -49,7 +49,7 @@ test('G3: force_connect keeps connector even when GPX covers both markers', asyn
|
||||
var e1 = { lat: '43.000', lng: '11.000', force_connect: false };
|
||||
var e2 = { lat: '43.010', lng: '11.010', force_connect: true };
|
||||
var track = [[43.000, 11.000], [43.005, 11.005], [43.010, 11.010]];
|
||||
return MapUtils.buildJourneySegments([e1, e2], [track], 10).length;
|
||||
return MapUtils.buildJourneySegments([e1, e2], { connectMode: 'intelligent_gpx' }, [track]).length;
|
||||
});
|
||||
|
||||
expect(count).toBe(1);
|
||||
@@ -65,7 +65,7 @@ test('G4: connector kept when markers are near different GPX files', async ({ pa
|
||||
// Two separate files — each only covers one marker
|
||||
var trackA = [[43.000, 11.000], [43.005, 11.005]]; // near e1 only
|
||||
var trackB = [[45.000, 13.000], [45.005, 13.005]]; // near e2 only
|
||||
return MapUtils.buildJourneySegments([e1, e2], [trackA, trackB], 10).length;
|
||||
return MapUtils.buildJourneySegments([e1, e2], { connectMode: 'intelligent_gpx' }, [trackA, trackB]).length;
|
||||
});
|
||||
|
||||
expect(count).toBe(1);
|
||||
@@ -82,7 +82,7 @@ test('G5: suppressed first pair leaves one segment from e2 to e3', async ({ page
|
||||
var e2 = { lat: '43.010', lng: '11.010', force_connect: false };
|
||||
var e3 = { lat: '45.000', lng: '13.000', force_connect: false };
|
||||
var track = [[43.000, 11.000], [43.005, 11.005], [43.010, 11.010]]; // covers e1 and e2 only
|
||||
var segs = MapUtils.buildJourneySegments([e1, e2, e3], [track], 10);
|
||||
var segs = MapUtils.buildJourneySegments([e1, e2, e3], { connectMode: 'intelligent_gpx' }, [track]);
|
||||
return segs.length;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user