mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
test(ui): wait for save to finish so TeamSSOSettings state updates don't leak past teardown
The 'should disable cancel button while saving' test mocks the save API with setTimeout(100) but never waits for the promise to resolve. When the timer fires after the test tears down, setSaving(false) tries to schedule a React update on an unmounted root, and resolveUpdatePriority reads window on a dead JSDOM. Vitest surfaces this as 'ReferenceError: window is not defined' and fails the whole UI Unit Tests job intermittently. Wait for the Edit Settings button to reappear after Save Changes so the mocked save resolves before the test exits. Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
d36e032241
commit
fde80e898f
1 changed files with 4 additions and 0 deletions
|
|
@ -567,5 +567,9 @@ describe("TeamSSOSettings", () => {
|
|||
await userEvent.click(screen.getByRole("button", { name: /Save Changes/i }));
|
||||
|
||||
expect(screen.getByRole("button", { name: /Cancel/i })).toBeDisabled();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("button", { name: /Edit Settings/i })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue