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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user