From caea0d5633e5b99de2a025450b3125d898fc9c35 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 3 Jun 2026 08:17:51 +0200 Subject: [PATCH] test(persons): assert the card title by exact message, not regex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit toHaveAttribute compares by equality, so passing a regex asserted against the literal RegExp object and failed. Assert the full title against m.person_correspondents_search_title(...) instead — it names both persons and avoids retyping the copy. Co-Authored-By: Claude Opus 4.8 --- .../persons/[id]/CoCorrespondentsList.svelte.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/persons/[id]/CoCorrespondentsList.svelte.test.ts b/frontend/src/routes/persons/[id]/CoCorrespondentsList.svelte.test.ts index c5262ee3..afccedc0 100644 --- a/frontend/src/routes/persons/[id]/CoCorrespondentsList.svelte.test.ts +++ b/frontend/src/routes/persons/[id]/CoCorrespondentsList.svelte.test.ts @@ -73,9 +73,14 @@ describe('CoCorrespondentsList', () => { } }); + // Asserted against the de message (names both persons) — not retyped copy. const link = page.getByRole('link', { name: /max mustermann/i }); - await expect.element(link).toHaveAttribute('title', /Anna Schmidt/); - await expect.element(link).toHaveAttribute('title', /Max Mustermann/); + await expect + .element(link) + .toHaveAttribute( + 'title', + m.person_correspondents_search_title({ A: 'Anna Schmidt', B: 'Max Mustermann' }) + ); }); it('builds initials from up to two name parts', async () => {