From fd509fbfac3374a21b169e8092f20a5756b9a89d Mon Sep 17 00:00:00 2001 From: le king fu Date: Tue, 3 Nov 2026 20:42:15 -0500 Subject: [PATCH] test(web): pin dueDate with a tag filter and a non-integer priority Review of PR #186: both behaviour changes of the shared task query were untested; removing either condition left the suite green. Refs #179 Co-Authored-By: Claude Opus 5.5 --- web/src/lib/taskQueries.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web/src/lib/taskQueries.test.ts b/web/src/lib/taskQueries.test.ts index 342091e..16bfa8f 100644 --- a/web/src/lib/taskQueries.test.ts +++ b/web/src/lib/taskQueries.test.ts @@ -181,6 +181,22 @@ describe('GET /api/lists/[id]/tasks?tags=', () => { expect((await res.json() as { id: string }[]).map((t) => t.id)).toEqual([a.t2]); }); + it('applies dueDate with a tag filter', async () => { + const a = await seedAccount(); + await exec('UPDATE sl_tasks SET due_date = $1 WHERE id = $2', ['2026-01-10T00:00:00Z', a.t1]); + // t2 (blue too) has no due date: excluded by the dueDate filter + const res = await getTasks(a.userId, a.list, `?tags=${a.blue}&dueDate=2026-02-01T00:00:00Z`); + expect(res.status).toBe(200); + expect((await res.json() as { id: string }[]).map((t) => t.id)).toEqual([a.t1]); + }); + + it('ignores a non-integer priority instead of failing', async () => { + const a = await seedAccount(); + const res = await getTasks(a.userId, a.list, '?priority=abc'); + expect(res.status).toBe(200); + expect((await res.json() as { id: string }[]).map((t) => t.id)).toEqual([a.t1, a.t2, a.t3]); + }); + it('still answers 404 for a list of another account', async () => { const a = await seedAccount(); const res = await getTasks(`user-${u()}`, a.list, '');