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 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-11-03 20:42:15 -05:00
commit fd509fbfac

View file

@ -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, '');