diff --git a/web/src/lib/taskWrites.test.ts b/web/src/lib/taskWrites.test.ts index 1658d24..0a56164 100644 --- a/web/src/lib/taskWrites.test.ts +++ b/web/src/lib/taskWrites.test.ts @@ -704,6 +704,8 @@ describe('createTag', () => { it('returns the live tag of the account that has the name, whatever the letter case and the spaces around it, and writes nothing', async () => { const A = await newAccount(); const id = await newTag(A.userId, { name: 'Courses', color: '#C17767' }); + // A name stored with spaces around it: POST /api/tags stores what it receives. + const spaced = await newTag(A.userId, { name: ' Maison ' }); const before = await everything(); for (const name of ['Courses', 'courses', 'COURSES', ' cOuRsEs ', '\tcourses\n']) { @@ -712,13 +714,14 @@ describe('createTag', () => { changed: false, tag: { id, name: 'Courses', color: '#C17767', updatedAt: new Date(SEEDED) }, }); } + expect(await makeTag(A.userId, { name: 'maison' })).toMatchObject({ changed: false, tag: { id: spaced, name: ' Maison ' } }); expect(await everything()).toEqual(before); // A name that only starts, ends or reads like it is another name. for (const name of ['Course', 'Courses bio', 'Mes courses', 'Cour ses']) { expect(await makeTag(A.userId, { name }), name).toMatchObject({ changed: true, tag: { name } }); } - expect(await tagNames(A.userId)).toHaveLength(5); + expect(await tagNames(A.userId)).toHaveLength(6); }); it('creates one tag for the same name asked twice, and a second call finds the first', async () => {