Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(server): narrow a partial ways answer the way the server build can, format three tests

Mauricee6002444a1cb
diff --git a/server/tests/unit/db/tour-ski-options-column.test.ts b/server/tests/unit/db/tour-ski-options-column.test.ts
index a007e0bc2..0b6eca965 100644
--- a/server/tests/unit/db/tour-ski-options-column.test.ts
+++ b/server/tests/unit/db/tour-ski-options-column.test.ts
@@ -19,7 +19,10 @@ describe('the ski options column', () => {
const idx = names.indexOf(TARGET);
expect(idx).toBeGreaterThan(0);
await migrateTo(orm, names[idx - 1] as string);
- await rawExec(orm, "INSERT INTO users (id, username, email, password_hash) VALUES (1, 'owner', 'owner@test', 'x')");
+ await rawExec(
+ orm,
+ "INSERT INTO users (id, username, email, password_hash) VALUES (1, 'owner', 'owner@test', 'x')",
+ );
await rawExec(orm, "INSERT INTO trips (id, user_id, title) VALUES (10, 1, 'Alps')");
await rawExec(orm, "INSERT INTO places (id, trip_id, name) VALUES (100, 10, 'Valley run')");
await rawExec(orm, "INSERT INTO tours (place_id, tour_type, ski_discipline) VALUES (100, 'ski', 'alpine')");
diff --git a/server/tests/unit/nest/admin.controller.test.ts b/server/tests/unit/nest/admin.controller.test.ts
index b00758fd4..a383e9454 100644
--- a/server/tests/unit/nest/admin.controller.test.ts
+++ b/server/tests/unit/nest/admin.controller.test.ts
@@ -500,11 +500,7 @@ describe('AdminController feature toggles', () => {
[() => c.updateToursWanderer(user, { enabled: true }, req), 'admin.tours_wanderer', 'updateToursWanderer'],
[() => c.updateToursHikingMap(user, { enabled: true }, req), 'admin.tours_hiking_map', 'updateToursHikingMap'],
[() => c.updateToursCycleMap(user, { enabled: true }, req), 'admin.tours_cycle_map', 'updateToursCycleMap'],
- [
- () => c.updateToursSkiRouting(user, { enabled: true }, req),
- 'admin.tours_ski_routing',
- 'updateToursSkiRouting',
- ],
+ [() => c.updateToursSkiRouting(user, { enabled: true }, req), 'admin.tours_ski_routing', 'updateToursSkiRouting'],
[() => c.updatePlacesPhotos(user, { enabled: true }, req), 'admin.places_photos', 'updatePlacesPhotos'],
[
() => c.updatePlacesAutocomplete(user, { enabled: true }, req),
diff --git a/server/tests/unit/nest/ski-routing/invariants.test.ts b/server/tests/unit/nest/ski-routing/invariants.test.ts
index 5ce38959f..31c513598 100644
--- a/server/tests/unit/nest/ski-routing/invariants.test.ts
+++ b/server/tests/unit/nest/ski-routing/invariants.test.ts
@@ -146,8 +146,7 @@ describe.each([
const request = skiRouteRequestSchema.parse({ legs: [{ from: point(), to: point() }], discipline });
const profile = profileOf(request);
const costs = compileProfile(profile, net);
- const modeOf = (step: Step) =>
- (step.dir === 0 ? costs.modeFwd[step.edge] : costs.modeBack[step.edge]) as number;
+ const modeOf = (step: Step) => (step.dir === 0 ? costs.modeFwd[step.edge] : costs.modeBack[step.edge]) as number;
let planned = 0;
for (let pair = 0; pair < PAIRS; pair++) {
const from = point();
diff --git a/server/tests/unit/nest/trek-places.client.test.ts b/server/tests/unit/nest/trek-places.client.test.ts
index 61ba695f9..c09751dd3 100644
--- a/server/tests/unit/nest/trek-places.client.test.ts
+++ b/server/tests/unit/nest/trek-places.client.test.ts
@@ -970,7 +970,7 @@ describe('trekPlacesWays', () => {
const ids = Array.from({ length: 1400 }, (_, index) => index + 1);
const answer = await trekPlacesWays(ids);
expect(calls).toHaveLength(2);
- if (answer.complete) throw new Error('expected an answer that stopped part way');
+ if (answer.complete !== false) throw new Error('expected an answer that stopped part way');
expect(answer.ways).toEqual([{ type: 'way', id: 2, tags: { surface: 'gravel' } }]);
expect(answer.unanswered).toEqual(ids.slice(500));
expect(trekPlacesMiss(answer.failure)).toBe('failed');