test(documents): replace 2 setTimeout sleeps in [id]/edit page with vi.waitFor

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-11 17:39:32 +02:00
parent 96366463ab
commit f2a48f0a34

View File

@@ -60,8 +60,7 @@ describe('documents/[id]/edit page', () => {
it('uses doc.title in the document title when set', async () => {
render(DocumentEditPage, { props: { data: baseData(), form: undefined } });
await new Promise((r) => setTimeout(r, 30));
expect(document.title).toContain('Brief an Helene');
await vi.waitFor(() => expect(document.title).toContain('Brief an Helene'));
});
it('falls back to originalFilename when title is empty', async () => {
@@ -72,8 +71,7 @@ describe('documents/[id]/edit page', () => {
}
});
await new Promise((r) => setTimeout(r, 30));
expect(document.title).toContain('fallback.pdf');
await vi.waitFor(() => expect(document.title).toContain('fallback.pdf'));
});
it('renders the cancel link to the document detail page', async () => {