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 82e151c42d - Show all commits

View File

@@ -168,4 +168,85 @@ describe('documents/[id] page', () => {
})
).not.toThrow();
});
it('renders without throwing with sender/receivers populated', async () => {
mockPage.url = new URL('http://localhost/documents/d7');
expect(() =>
render(DocumentDetailPage, {
props: {
data: baseData({
document: {
...baseDoc,
id: 'd7',
sender: { id: 's1', displayName: 'Anna Schmidt' },
receivers: [{ id: 'r1', displayName: 'Bert Meier' }]
}
})
}
})
).not.toThrow();
});
it('renders without throwing when filePath is set on the document', async () => {
mockPage.url = new URL('http://localhost/documents/d8');
expect(() =>
render(DocumentDetailPage, {
props: {
data: baseData({
document: {
...baseDoc,
id: 'd8',
filePath: 's3://bucket/file.pdf',
contentType: 'application/pdf'
}
})
}
})
).not.toThrow();
});
it('renders without throwing with a complete user object', async () => {
mockPage.url = new URL('http://localhost/documents/d9');
expect(() =>
render(DocumentDetailPage, {
props: {
data: baseData({
document: { ...baseDoc, id: 'd9' },
user: { id: 'u1', firstName: 'Anna', lastName: 'S', email: 'a@x' }
})
}
})
).not.toThrow();
});
it('handles Escape keydown without throwing (close transcribe path)', async () => {
mockPage.url = new URL('http://localhost/documents/d10');
render(DocumentDetailPage, {
props: { data: baseData({ document: { ...baseDoc, id: 'd10' } }) }
});
expect(() =>
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))
).not.toThrow();
});
it('handles non-Escape keydown without firing close handler', async () => {
mockPage.url = new URL('http://localhost/documents/d11');
render(DocumentDetailPage, {
props: { data: baseData({ document: { ...baseDoc, id: 'd11' } }) }
});
expect(() =>
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab', bubbles: true }))
).not.toThrow();
});
it('renders without throwing with a deep-link comment query param', async () => {
mockPage.url = new URL('http://localhost/documents/d12?comment=c-abc');
expect(() =>
render(DocumentDetailPage, {
props: { data: baseData({ document: { ...baseDoc, id: 'd12' } }) }
})
).not.toThrow();
});
});