diff --git a/frontend/src/routes/persons/page.svelte.test.ts b/frontend/src/routes/persons/page.svelte.test.ts index 0c670576..71d90e6f 100644 --- a/frontend/src/routes/persons/page.svelte.test.ts +++ b/frontend/src/routes/persons/page.svelte.test.ts @@ -187,4 +187,110 @@ describe('persons/+ page', () => { await expect.element(page.getByText(/Anni/)).toBeVisible(); }); + + it('shows the institution svg icon for INSTITUTION personType', async () => { + render(PersonsListPage, { + props: { + data: baseData({ + persons: [ + { + id: 'p1', + firstName: '', + lastName: 'Bundesarchiv', + displayName: 'Bundesarchiv', + personType: 'INSTITUTION' + } + ] + }) + } + }); + + // SVG icon (not initials text) + const card = document.querySelector('a[href="/persons/p1"]'); + expect(card?.querySelector('svg')).not.toBeNull(); + }); + + it('shows the group svg icon for GROUP personType', async () => { + render(PersonsListPage, { + props: { + data: baseData({ + persons: [ + { + id: 'pg', + firstName: '', + lastName: 'Family X', + displayName: 'Family X', + personType: 'GROUP' + } + ] + }) + } + }); + + const card = document.querySelector('a[href="/persons/pg"]'); + expect(card?.querySelector('svg')).not.toBeNull(); + }); + + it('shows the unknown svg icon for UNKNOWN personType', async () => { + render(PersonsListPage, { + props: { + data: baseData({ + persons: [ + { + id: 'pu', + firstName: '', + lastName: 'Unknown', + displayName: 'Unknown', + personType: 'UNKNOWN' + } + ] + }) + } + }); + + const card = document.querySelector('a[href="/persons/pu"]'); + expect(card?.querySelector('svg')).not.toBeNull(); + }); + + it('renders only birthYear with em-dash when no death year', async () => { + render(PersonsListPage, { + props: { + data: baseData({ + persons: [ + { + id: 'p1', + firstName: 'Anna', + lastName: 'Schmidt', + displayName: 'Anna Schmidt', + personType: 'PERSON', + birthYear: 1899 + } + ] + }) + } + }); + + expect(document.body.textContent).toContain('1899'); + }); + + it('renders only deathYear with em-dash when no birth year', async () => { + render(PersonsListPage, { + props: { + data: baseData({ + persons: [ + { + id: 'p1', + firstName: 'Anna', + lastName: 'Schmidt', + displayName: 'Anna Schmidt', + personType: 'PERSON', + deathYear: 1950 + } + ] + }) + } + }); + + expect(document.body.textContent).toContain('1950'); + }); });