mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(access-groups): build the pending-save fixture with Promise.withResolvers
The dismiss-while-pending test seeded its deferred promise by declaring the resolver with let and reassigning it inside the executor. Promise.withResolvers gives the same handle without the reassignment, and the assertions are unchanged.
This commit is contained in:
parent
1e4f66f0fc
commit
08a306f198
1 changed files with 2 additions and 7 deletions
|
|
@ -231,13 +231,8 @@ describe("AccessGroupEditDialog", () => {
|
|||
|
||||
it("cannot be dismissed while a save is pending, then closes once on success", async () => {
|
||||
const user = userEvent.setup();
|
||||
let resolveSave: (value: AccessGroupResponse | undefined) => void = () => {};
|
||||
const patchAccessGroup = vi.fn().mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
resolveSave = resolve;
|
||||
}),
|
||||
);
|
||||
const { promise: pendingSave, resolve: resolveSave } = Promise.withResolvers<AccessGroupResponse | undefined>();
|
||||
const patchAccessGroup = vi.fn().mockReturnValue(pendingSave);
|
||||
renderDialog({ patchAccessGroup });
|
||||
|
||||
await user.clear(screen.getByLabelText("Description"));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue