test(briefwechsel): replace 1 setTimeout sleep in CorrespondenzPersonBar with vi.waitFor

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-11 17:43:28 +02:00
parent 57ac82b823
commit a3f5ba55f4

View File

@@ -110,10 +110,8 @@ describe('CorrespondenzPersonBar', () => {
const corrInput = inputs[inputs.length - 1] as HTMLInputElement;
corrInput.dispatchEvent(new Event('focus', { bubbles: true }));
await new Promise((r) => setTimeout(r, 100));
// No assertion on the suggestions dropdown UI (component-internal),
// just confirm the fetch was made
expect(fetchSpy).toHaveBeenCalled();
// Confirm the typeahead fired the suggestions fetch.
await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalled());
} finally {
fetchSpy.mockRestore();
}