From 54ef1643a4460069b0373c835cf8bd145e36f027 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 23 Apr 2026 20:35:25 +0200 Subject: [PATCH] test(briefwechsel): lock future-date relative-year hiding at the row layer relativeYearsDe already returns "" for future dates (covered in its own spec), but the integration wiring inside ThumbnailRow was untested. Adds a regression that a doc with documentDate in the future produces no "vor N Jahren" or "vor weniger als 1 Jahr" chip. Refs #305 Fixes @saraholt concern 5 from PR review Co-Authored-By: Claude Sonnet 4.6 --- .../src/lib/components/ThumbnailRow.svelte.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/lib/components/ThumbnailRow.svelte.spec.ts b/frontend/src/lib/components/ThumbnailRow.svelte.spec.ts index ae0542e1..9c41fc65 100644 --- a/frontend/src/lib/components/ThumbnailRow.svelte.spec.ts +++ b/frontend/src/lib/components/ThumbnailRow.svelte.spec.ts @@ -104,6 +104,20 @@ describe('ThumbnailRow', () => { expect(document.body.textContent).toContain('vor 76 Jahren'); }); + it('hides the relative-year label when documentDate is in the future', () => { + // relativeYearsDe returns "" for future/invalid dates; the row must not + // then render an empty chip or print "vor 0 Jahren". + render(ThumbnailRow, { + doc: { ...baseDoc, documentDate: '2030-01-01' }, + isOut: true, + showOtherParty: false, + now: new Date('2026-06-01T00:00:00Z') + }); + + expect(document.body.textContent).not.toMatch(/vor \d+ Jahr/); + expect(document.body.textContent).not.toMatch(/vor weniger/); + }); + it('sets border-l class based on isOut', () => { const { unmount } = render(ThumbnailRow, { doc: baseDoc,