mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 11:06:06 +00:00
73237ffedb
The tour type is a dropdown; a bike tour picks its profile, routes for it, says when a point lies off every way, and shows what it runs on: surfaces, kinds of way and, for a mountain bike, the trail grades, each pointed at on the map. A type's own map (OpenHikingMap for a hike, CyclOSM for a bike tour) is offered while a tour of that type is open, with an admin switch each. From the planned cards: a hike avoids steep climbs, steps or ferries, nothing else; a saved tour can be shared where the platform takes GPX files; and the tours rail adds a tour from one menu: plan new, import GPX, or take one over from another trip.
39 lines
1.9 KiB
TypeScript
39 lines
1.9 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import { isOnTermsBase, tileHealthHandlers, TOUR_RASTER_BASES, tourRasterBaseOf } from './tourRasterBases';
|
|
|
|
// FE-MAP-TOURBASES-001 to FE-MAP-TOURBASES-003
|
|
|
|
describe('tourRasterBases (MAP-01, BIK-06)', () => {
|
|
it('FE-MAP-TOURBASES-001: knows topo, OpenHikingMap and CyclOSM, CyclOSM on its three shards', () => {
|
|
expect(tourRasterBaseOf('topo')).toBe(TOUR_RASTER_BASES.topo);
|
|
expect(tourRasterBaseOf('cycle')?.tiles).toEqual([
|
|
'https://a.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
|
'https://b.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
|
'https://c.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
|
]);
|
|
expect(tourRasterBaseOf('cycle')?.maxZoom).toBe(20);
|
|
expect(tourRasterBaseOf('satellite')).toBeNull();
|
|
// Inherited names are no base map.
|
|
expect(tourRasterBaseOf('toString')).toBeNull();
|
|
});
|
|
|
|
it('FE-MAP-TOURBASES-002: the maps on terms carry their credit; topo is no map on terms', () => {
|
|
expect(isOnTermsBase('hiking')).toBe(true);
|
|
expect(isOnTermsBase('cycle')).toBe(true);
|
|
expect(isOnTermsBase('topo')).toBe(false);
|
|
expect(isOnTermsBase('default')).toBe(false);
|
|
expect(TOUR_RASTER_BASES.cycle.onTerms?.credit.map((part) => part.href)).toEqual([
|
|
'https://www.cyclosm.org',
|
|
'https://www.openstreetmap.org/copyright',
|
|
]);
|
|
expect(TOUR_RASTER_BASES.hiking.onTerms?.credit).toHaveLength(3);
|
|
});
|
|
|
|
it('FE-MAP-TOURBASES-003: a Leaflet layer reports into the health of the map watched, and only of that one', () => {
|
|
const health = { base: 'cycle' as const, down: false, onTileError: vi.fn(), onTileLoad: vi.fn() };
|
|
expect(tileHealthHandlers(health, 'cycle')).toEqual({ tileerror: health.onTileError, tileload: health.onTileLoad });
|
|
expect(tileHealthHandlers(health, 'hiking')).toBeUndefined();
|
|
expect(tileHealthHandlers(undefined, 'cycle')).toBeUndefined();
|
|
});
|
|
});
|