mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
chore(shared): format the tours and wanderer locale and spec files
This commit is contained in:
@@ -8,7 +8,13 @@ const activity = {
|
||||
assignment_id: 12,
|
||||
day_id: 3,
|
||||
assigned_at: '2026-07-02T18:00:00Z',
|
||||
track: { place_id: 9, name: 'Watch export', origin: 'gpx', file_name: 'morning.gpx', imported_at: '2026-07-02 17:58:00' },
|
||||
track: {
|
||||
place_id: 9,
|
||||
name: 'Watch export',
|
||||
origin: 'gpx',
|
||||
file_name: 'morning.gpx',
|
||||
imported_at: '2026-07-02 17:58:00',
|
||||
},
|
||||
metrics: {
|
||||
distance_km: 12.4,
|
||||
elevation_gain_m: 640,
|
||||
|
||||
@@ -192,6 +192,8 @@ describe('MDT-01 tour stages', () => {
|
||||
expect(tourListItemSchema.parse({ ...item, stage_stops: null }).stage_stops).toBeNull();
|
||||
expect(tourListItemSchema.parse(item).stage_stops).toBeUndefined();
|
||||
expect(tourListItemSchema.safeParse({ ...item, stage_stops: [stops[0]] }).success).toBe(false);
|
||||
expect(tourListItemSchema.safeParse({ ...item, stage_stops: [{ ...stops[0], key: '' }, stops[1]] }).success).toBe(false);
|
||||
expect(tourListItemSchema.safeParse({ ...item, stage_stops: [{ ...stops[0], key: '' }, stops[1]] }).success).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,9 +53,9 @@ describe('tour trail grades (BIK-05, MAP-03, MAP-04)', () => {
|
||||
const written = tourTrailGradeSchema.parse({ ...grade, surface: 'fine_gravel', highway: 'path' });
|
||||
expect(written).toMatchObject({ surface: 'fine_gravel', highway: 'path' });
|
||||
expect(tourTrailGradeSchema.safeParse({ ...grade, surface: '' }).success).toBe(false);
|
||||
expect(
|
||||
tourTrailGradeSchema.safeParse({ ...grade, highway: 'x'.repeat(OSM_TAG_VALUE_MAX + 1) }).success,
|
||||
).toBe(false);
|
||||
expect(tourTrailGradeSchema.safeParse({ ...grade, highway: 'x'.repeat(OSM_TAG_VALUE_MAX + 1) }).success).toBe(
|
||||
false,
|
||||
);
|
||||
expect(tourTrailGradeSchema.safeParse({ ...grade, surface: undefined }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -618,11 +618,13 @@ describe('runs (RUN-01)', () => {
|
||||
});
|
||||
|
||||
it('saves a trail run like any run, with its own profile and the same pace (RUN-02)', () => {
|
||||
expect(tourCreateRequestSchema.parse({ ...run, run_profile: 'trail', run_pace_seconds_per_km: 450 })).toMatchObject({
|
||||
tour_type: 'run',
|
||||
run_profile: 'trail',
|
||||
run_pace_seconds_per_km: 450,
|
||||
});
|
||||
expect(tourCreateRequestSchema.parse({ ...run, run_profile: 'trail', run_pace_seconds_per_km: 450 })).toMatchObject(
|
||||
{
|
||||
tour_type: 'run',
|
||||
run_profile: 'trail',
|
||||
run_pace_seconds_per_km: 450,
|
||||
},
|
||||
);
|
||||
expect(tourGpxImportFieldsSchema.parse({ tour_type: 'run', run_profile: 'trail' }).run_profile).toBe('trail');
|
||||
expect(() => tourCreateRequestSchema.parse({ ...baseRequest, run_profile: 'trail' })).toThrow(/belongs to a run/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user