test(routes): hit truthy/falsy data.X || '' branches in documents page

Adds two tests that pass all filter props as truthy and as falsy
defaults, covering the seed-from-data-or-default branches.

2 new tests covering ~14 branches (all data.X || '' chains).

Refs #496.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-10 05:46:40 +02:00
committed by marcel
parent 12733cb699
commit 39c8413c46

View File

@@ -285,4 +285,55 @@ describe('documents/+ page', () => {
})
).not.toThrow();
});
it('renders without throwing with every filter set to a truthy value', async () => {
// This hits every "data.X || ''" truthy branch on lines 19-34 of +page.svelte.
expect(() =>
render(DocumentsListPage, {
props: {
data: baseData({
q: 'brief',
from: '1899-01-01',
to: '1950-12-31',
senderId: 'p-sender',
receiverId: 'p-receiver',
initialSenderName: 'Anna',
initialReceiverName: 'Bert',
tags: ['Familie'],
sort: 'TITLE',
dir: 'asc',
tagQ: 'Bri',
tagOp: 'OR',
zoomFrom: '1900-01-01',
zoomTo: '1940-12-31'
})
}
})
).not.toThrow();
});
it('renders without throwing with every filter at its falsy default', async () => {
expect(() =>
render(DocumentsListPage, {
props: {
data: baseData({
q: '',
from: '',
to: '',
senderId: '',
receiverId: '',
initialSenderName: '',
initialReceiverName: '',
tags: [],
sort: '',
dir: '',
tagQ: '',
tagOp: 'AND',
zoomFrom: null,
zoomTo: null
})
}
})
).not.toThrow();
});
});