test(admin): replace 1 setTimeout sleep in invites page with vi.waitFor
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, afterEach } from 'vitest';
|
||||
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||
import { cleanup, render } from 'vitest-browser-svelte';
|
||||
import { page } from 'vitest/browser';
|
||||
import AdminInvitesPage from './+page.svelte';
|
||||
@@ -239,10 +239,10 @@ describe('admin/invites page', () => {
|
||||
/neue|invite|einladung/i.test(b.textContent ?? '')
|
||||
) as HTMLButtonElement | undefined;
|
||||
newBtn?.click();
|
||||
await new Promise((r) => setTimeout(r, 30));
|
||||
|
||||
const formAfter = document.querySelector('form[action="?/create"]');
|
||||
expect(formAfter).not.toBeNull();
|
||||
await vi.waitFor(() => {
|
||||
expect(document.querySelector('form[action="?/create"]')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
it('shows the load error banner when data.loadError is set', async () => {
|
||||
|
||||
Reference in New Issue
Block a user