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.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
test: keep the new tests within the lint and hand-built service ratchets
Mauricebcad06970551
diff --git a/server/tests/unit/nest/assistant/assistant-tool-cap.test.ts b/server/tests/unit/nest/assistant/assistant-tool-cap.test.tsindex 6780dbad1..a2d26d611 100644--- a/server/tests/unit/nest/assistant/assistant-tool-cap.test.ts+++ b/server/tests/unit/nest/assistant/assistant-tool-cap.test.ts@@ -170,10 +170,11 @@ describe('the tools one step offers', () => {const steps = await within(tripSession(), async (session) => {const port = attachedPort(session, ATTACHED_TURN);const counts: Array<{ group: string; offered: number }> = [];- for (const group of GROUPS) {+ await GROUPS.reduce(async (previous, group) => {+ await previous;await session.call('use_addon_tools', { groups: [group] });counts.push({ group, offered: port.specs().length });- }+ }, Promise.resolve());await session.call('use_addon_tools', { groups: GROUPS });counts.push({ group: 'all', offered: port.specs().length });return counts;diff --git a/server/tests/unit/nest/auth.controller.test.ts b/server/tests/unit/nest/auth.controller.test.tsindex b0e8940a7..6a6718ca2 100644--- a/server/tests/unit/nest/auth.controller.test.ts+++ b/server/tests/unit/nest/auth.controller.test.ts@@ -550,9 +550,11 @@ describe('AuthController (authenticated)', () => {const other = { ...user, id: 2 } as User;// Both users sit behind the same NAT address, and the first one burns its// whole ceiling.- for (let i = 0; i < 120; i++) {- await ac(asvc({}), s, { createWsToken: vi.fn().mockReturnValue({ token: 'ws' }) }).wsToken(user, req);- }+ await Promise.all(+ Array.from({ length: 120 }, () =>+ ac(asvc({}), s, { createWsToken: vi.fn().mockReturnValue({ token: 'ws' }) }).wsToken(user, req),+ ),+ );expect(await thrownAsync(() =>ac(asvc({}), s, { createWsToken: vi.fn().mockReturnValue({ token: 'ws' }) }).wsToken(user, req),diff --git a/server/tests/unit/nest/auth.service.test.ts b/server/tests/unit/nest/auth.service.test.tsindex 900c7ea79..af0f3852e 100644--- a/server/tests/unit/nest/auth.service.test.ts+++ b/server/tests/unit/nest/auth.service.test.ts@@ -1470,7 +1470,7 @@ describe('resetPassword', () => {await updateRows(orm, Users, { id: user.id }, { email: '[email protected]' });expect(- await asLegacyResult(svc.resetPassword({ token: issued.tokenForDelivery!, new_password: 'Fresh123!' })),+ await asLegacyResult(svc.resetPassword({ token: issued.tokenForDelivery ?? '', new_password: 'Fresh123!' })),).toEqual({ error: 'Invalid or expired reset link', status: 400 });expect((await readUser(orm, user.id)).password_version).toBe(0);});@@ -1480,14 +1480,14 @@ describe('resetPassword', () => {const issued = await svc.requestPasswordReset(user.email, null);await updateRows(orm, Users, { id: user.id }, { email: user.email.toUpperCase() });expect(- await asLegacyResult(svc.resetPassword({ token: issued.tokenForDelivery!, new_password: 'Fresh123!' })),+ await asLegacyResult(svc.resetPassword({ token: issued.tokenForDelivery ?? '', new_password: 'Fresh123!' })),).toEqual({ success: true, userId: user.id });const { user: older } = createUser(testDb);const legacy = await svc.requestPasswordReset(older.email, null);await updateRows(orm, PasswordResetTokens, { user: older.id }, { email: null });expect(- await asLegacyResult(svc.resetPassword({ token: legacy.tokenForDelivery!, new_password: 'Fresh123!' })),+ await asLegacyResult(svc.resetPassword({ token: legacy.tokenForDelivery ?? '', new_password: 'Fresh123!' })),).toEqual({ success: true, userId: older.id });});});diff --git a/server/tests/unit/nest/oidc-backchannel.controller.test.ts b/server/tests/unit/nest/oidc-backchannel.controller.test.tsindex 64e4495bc..7faee4087 100644--- a/server/tests/unit/nest/oidc-backchannel.controller.test.ts+++ b/server/tests/unit/nest/oidc-backchannel.controller.test.ts@@ -126,9 +126,7 @@ describe('OidcBackchannelController POST /api/auth/oidc/backchannel-logout', ()it('BCL-CTL-007: every request is counted at the door, and a valid logout gives its attempt back', async () => {const n = BACKCHANNEL_LOGOUT_RATE_LIMIT + 5;- for (let i = 0; i < n; i++) {- await controller().logout(req({ logout_token: 'a.b.c' }), makeRes());- }+ await Promise.all(Array.from({ length: n }, () => controller().logout(req({ logout_token: 'a.b.c' }), makeRes())));expect(check).toHaveBeenCalledTimes(n);expect(release).toHaveBeenCalledTimes(n);expect(release).toHaveBeenLastCalledWith('oidc_backchannel', '198.51.100.7', 60_000, expect.any(Number));diff --git a/server/tests/unit/nest/rate-limit.service.test.ts b/server/tests/unit/nest/rate-limit.service.test.tsindex 70002c96a..ed2ff6cbf 100644--- a/server/tests/unit/nest/rate-limit.service.test.ts+++ b/server/tests/unit/nest/rate-limit.service.test.ts@@ -18,20 +18,18 @@ function bucketSize(service: RateLimitService, bucket: string): number {}describe('RateLimitService', () => {- it('allows up to max attempts in a window, then refuses', async () => {+ it('allows up to max attempts in a window, then refuses, counting only the attempts not given back', async () => {const s = new RateLimitService();const now = Date.now();for (let i = 0; i < 5; i++) expect(await s.check('login', '1.2.3.4', 5, WINDOW, now)).toBe(true);expect(await s.check('login', '1.2.3.4', 5, WINDOW, now)).toBe(false);- });- it('release gives back a counted attempt, so only the kept ones reach the limit', async () => {- const s = new RateLimitService();- const now = Date.now();- for (let i = 0; i < 5; i++) {+ // release gives back a counted attempt, so only the kept ones reach the limit+ await Array.from({ length: 5 }).reduce<Promise<void>>(async (previous) => {+ await previous;expect(await s.check('logout', '1.2.3.4', 2, WINDOW, now)).toBe(true);await s.release('logout', '1.2.3.4', WINDOW, now);- }+ }, Promise.resolve());expect(await s.check('logout', '1.2.3.4', 2, WINDOW, now)).toBe(true);expect(await s.check('logout', '1.2.3.4', 2, WINDOW, now)).toBe(true);expect(await s.check('logout', '1.2.3.4', 2, WINDOW, now)).toBe(false);