From a307d8d1c98044b6e52e680989087196403dad6c Mon Sep 17 00:00:00 2001 From: jubnl Date: Sat, 4 Apr 2026 00:17:34 +0200 Subject: [PATCH] test(trips): update TRIP-002 to expect default 7-day window Now that trips always default to a start+7 day window when no dates are provided, the test expectation of null dates and zero dated days is no longer valid. --- server/tests/integration/trips.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/tests/integration/trips.test.ts b/server/tests/integration/trips.test.ts index 6c619d7..b862b23 100644 --- a/server/tests/integration/trips.test.ts +++ b/server/tests/integration/trips.test.ts @@ -89,7 +89,7 @@ describe('Create trip', () => { expect(days[4].date).toBe('2026-06-05'); }); - it('TRIP-002 — POST /api/trips without dates returns 201 and no date-specific days', async () => { + it('TRIP-002 — POST /api/trips without dates returns 201 and defaults to a 7-day window', async () => { const { user } = createUser(testDb); const res = await request(app) @@ -99,12 +99,12 @@ describe('Create trip', () => { expect(res.status).toBe(201); expect(res.body.trip).toBeDefined(); - expect(res.body.trip.start_date).toBeNull(); - expect(res.body.trip.end_date).toBeNull(); + expect(res.body.trip.start_date).not.toBeNull(); + expect(res.body.trip.end_date).not.toBeNull(); - // Days with explicit dates should not be present + // Should have 8 days (start + 7 day window) const daysWithDate = testDb.prepare('SELECT * FROM days WHERE trip_id = ? AND date IS NOT NULL').all(res.body.trip.id) as any[]; - expect(daysWithDate).toHaveLength(0); + expect(daysWithDate).toHaveLength(8); }); it('TRIP-001 — POST /api/trips requires a title, returns 400 without one', async () => {