test(coverage): drive browser tests to 80% on all metrics (#496) #505

Merged
marcel merged 189 commits from feat/issue-496-browser-coverage-tests into main 2026-05-11 21:50:39 +02:00
Showing only changes of commit 87e87e17f5 - Show all commits

View File

@@ -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');
});
});