mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
test(ui): build the deferred removal with Promise.withResolvers
The pending-state test seeded its deferred promise by declaring the resolver with let and reassigning it inside the executor. Promise.withResolvers is the standard way to get the same handle without the reassignment, and the assertions are unchanged.
This commit is contained in:
parent
62b072dcf7
commit
7da8a3bef5
1 changed files with 2 additions and 6 deletions
|
|
@ -199,12 +199,8 @@ describe("CostTrackingSettings", () => {
|
|||
|
||||
it("should hold the confirmation open while the removal is still in flight", async () => {
|
||||
mockDiscountConfig.mockReturnValue({ openai: 0.05 });
|
||||
let settleRemoval: () => void = () => {};
|
||||
mockRemoveDiscount.mockReturnValue(
|
||||
new Promise<void>((resolve) => {
|
||||
settleRemoval = resolve;
|
||||
}),
|
||||
);
|
||||
const { promise, resolve: settleRemoval } = Promise.withResolvers<void>();
|
||||
mockRemoveDiscount.mockReturnValue(promise);
|
||||
|
||||
const user = await expandAndRemove("Provider Discounts", "Remove discount for openai");
|
||||
await user.click(await screen.findByRole("button", { name: "Remove" }));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue