mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(ui): teach TeamInfo mock about organizationKeys and stop stub buttons from submitting the form
The TeamInfo settings save path invalidates organization queries via organizationKeys.all, and the ModelAliasManager stub renders <button> elements without type="button", so any click inside the edit form was submitting it. Together these masked each other: the accidental submit threw on the missing organizationKeys export, the catch swallowed the error, teamUpdateCall had already been recorded, and the assertion was happy. Under CI load the pass-through routes test tipped past the 30s testTimeout while the form was stuck mid-save. Add organizationKeys to the mock so the invalidation succeeds and stamp type="button" on the alias-editor stubs so Set Alias / Clear Aliases only update parent state. The model_aliases tests now exercise the real click Set Alias -> click Save Changes flow instead of passing on the first accidental submit. Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
a738c45fc7
commit
05e89d9ccb
1 changed files with 7 additions and 2 deletions
|
|
@ -62,6 +62,7 @@ vi.mock("@/app/(dashboard)/hooks/teams/useTeams", () => ({
|
|||
vi.mock("@/app/(dashboard)/hooks/organizations/useOrganizations", () => ({
|
||||
useOrganization: vi.fn(),
|
||||
useOrganizations: vi.fn().mockReturnValue({ data: [], isLoading: false }),
|
||||
organizationKeys: { all: ["organizations"] },
|
||||
}));
|
||||
|
||||
vi.mock("@/app/(dashboard)/hooks/users/useCurrentUser", () => ({
|
||||
|
|
@ -121,8 +122,12 @@ vi.mock("@/components/common_components/ModelAliasManager", () => ({
|
|||
default: vi.fn(({ initialModelAliases, onAliasUpdate }) => (
|
||||
<div>
|
||||
<div data-testid="alias-editor-initial">{JSON.stringify(initialModelAliases)}</div>
|
||||
<button onClick={() => onAliasUpdate({ "gpt-4o": "gpt-4" })}>Set Alias</button>
|
||||
<button onClick={() => onAliasUpdate({})}>Clear Aliases</button>
|
||||
<button type="button" onClick={() => onAliasUpdate({ "gpt-4o": "gpt-4" })}>
|
||||
Set Alias
|
||||
</button>
|
||||
<button type="button" onClick={() => onAliasUpdate({})}>
|
||||
Clear Aliases
|
||||
</button>
|
||||
</div>
|
||||
)),
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue