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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user