mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 22:16:26 +00:00
test(tours): follow the ski tour changes in the tests
The collection tour fixture no longer writes the dropped winter_activity column, the drafts are saved as version 11, and a hike no longer offers the pistes layer, which belongs to a ski track only.
This commit is contained in:
@@ -116,7 +116,7 @@ describe('useTourPlanner, bike tours (BIK-01)', () => {
|
||||
await settle();
|
||||
act(() => result.current.setBikeProfile('road'));
|
||||
expect(JSON.parse(localStorage.getItem('tour-draft-52') || 'null')).toMatchObject({
|
||||
version: 10,
|
||||
version: 11,
|
||||
tourType: 'bike',
|
||||
bikeProfile: 'road',
|
||||
});
|
||||
|
||||
@@ -1618,7 +1618,7 @@ describe('useTourPlanner', () => {
|
||||
|
||||
expect(result.current.mode).toEqual({ type: 'new-draft' })
|
||||
expect(JSON.parse(localStorage.getItem('tour-draft-23') || 'null')).toMatchObject({
|
||||
version: 10,
|
||||
version: 11,
|
||||
tourType: 'hike',
|
||||
name: '',
|
||||
waypoints: [],
|
||||
|
||||
@@ -5,7 +5,7 @@ describe('tourMapLayersFor (MAP-01)', () => {
|
||||
it('offers OpenHikingMap to a hike only while the admin allows it', () => {
|
||||
expect(tourMapLayersFor('hike').bases).not.toContain('hiking');
|
||||
expect(tourMapLayersFor('hike', { hikingMap: true }).bases).toEqual(['default', 'topo', 'hiking', 'satellite']);
|
||||
expect(tourMapLayersFor('hike', { hikingMap: true }).overlays).toEqual(['ferratas', 'pistes']);
|
||||
expect(tourMapLayersFor('hike', { hikingMap: true }).overlays).toEqual(['ferratas']);
|
||||
expect(tourMapLayersFor('kayak', { hikingMap: true }).bases).not.toContain('hiking');
|
||||
expect(tourMapLayersFor(null, { hikingMap: true }).bases).not.toContain('hiking');
|
||||
});
|
||||
@@ -24,10 +24,9 @@ describe('tourMapLayersFor (MAP-01)', () => {
|
||||
expect(baseLayerFor(tourMapLayersFor('ski'), 'hiking')).toBe('default');
|
||||
});
|
||||
|
||||
it('SKI-01: the pistes are offered to a hike and a ski track, never to a bike tour, a run, a paddle tour or another type', () => {
|
||||
expect(tourMapLayersFor('hike').overlays).toContain('pistes');
|
||||
it('SKI-02: the pistes are offered to a ski track only, never to a hike, a bike tour, a run, a paddle tour or another type', () => {
|
||||
expect(tourMapLayersFor('ski').overlays).toContain('pistes');
|
||||
for (const type of ['bike', 'run', 'kayak', 'walk', null] as const)
|
||||
for (const type of ['hike', 'bike', 'run', 'kayak', 'walk', null] as const)
|
||||
expect(tourMapLayersFor(type).overlays).not.toContain('pistes');
|
||||
});
|
||||
|
||||
|
||||
@@ -770,11 +770,11 @@ describe('TourPlannerMapStage', () => {
|
||||
|
||||
const overlayStates = () => flat().tourLayers?.overlays?.map((overlay) => [overlay.id, overlay.status]);
|
||||
|
||||
it('a hike keeps the standard map, topo and satellite and the via ferrata layer, the pistes off, and no seamarks', () => {
|
||||
it('a hike keeps the standard map, topo and satellite and the via ferrata layer, and no pistes or seamarks', () => {
|
||||
renderStage(planner('new-draft'));
|
||||
expect(flat().tourLayers?.bases).toEqual(['default', 'topo', 'satellite']);
|
||||
expect(flat().ferrataLayer).toBeDefined();
|
||||
expect(overlayStates()).toEqual([['pistes', 'off']]);
|
||||
expect(overlayStates()).toEqual([]);
|
||||
});
|
||||
|
||||
it('with no tour open there is no via ferrata layer and no seamarks, but the pistes are offered (SKI-01)', () => {
|
||||
|
||||
@@ -66,7 +66,6 @@ function snapshot(collectionId: number, savedBy: number | null, overrides: Parti
|
||||
match_confidence: 1,
|
||||
max_hiking_difficulty: 3,
|
||||
bike_profile: null,
|
||||
winter_activity: null,
|
||||
run_profile: null,
|
||||
run_pace_seconds_per_km: null,
|
||||
ski_discipline: null,
|
||||
|
||||
Reference in New Issue
Block a user