test(web): the same tag id in both letter cases counts once (#203)

Found by mutation: without the lower-casing of the tag ids before they
are counted, every test stayed green. createTask and setTaskTags now
receive the same id in lower and upper case in one call.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-11-15 12:34:13 -05:00
commit 5f2d701c53

View file

@ -271,7 +271,8 @@ describe('createTask', () => {
it('links the tags of the account, each once, whatever the letter case of their ids', async () => {
const A = await newAccount();
const [red, blue] = [await newTag(A.userId), await newTag(A.userId)];
const { task } = await create(A.userId, { title: 'Tagged', tagIds: [red, blue.toUpperCase(), red] });
// Twice the same id, and the same id in both letter cases: one tag each.
const { task } = await create(A.userId, { title: 'Tagged', tagIds: [red, blue.toUpperCase(), red, blue] });
expect(await tagsOf(task.id)).toEqual([red, blue].sort());
// An empty list links nothing.
expect(await tagsOf((await create(A.userId, { title: 'Bare', tagIds: [] })).task.id)).toEqual([]);
@ -436,7 +437,7 @@ describe('setTaskTags', () => {
await link(id, blue);
const before = await everything();
for (const tagIds of [[red, blue], [blue, red], [blue, red.toUpperCase(), blue]]) {
for (const tagIds of [[red, blue], [blue, red], [blue, red.toUpperCase(), blue, red]]) {
expect(await setTags(A.userId, id, tagIds)).toMatchObject({ changed: false, task: { id, updatedAt: new Date(SEEDED) } });
}
expect(await setTags(A.userId, bareTask, [])).toMatchObject({ changed: false, task: { id: bareTask } });