Skip to content

Commit a12d0b8

Browse files
only21milcodex
andcommitted
test(web): use supported deferred promise construction
Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent 9bd00f6 commit a12d0b8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,11 @@ describe("Antigravity setup", () => {
188188
setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
189189
const idleInstallation = setup.installation!;
190190
setup.installation = null;
191-
const command = Promise.withResolvers<{ _tag: "Success"; value: undefined }>();
192-
setup.startInstall.mockReturnValueOnce(command.promise);
191+
let resolveStart!: () => void;
192+
const command = new Promise<{ _tag: "Success"; value: undefined }>((resolve) => {
193+
resolveStart = () => resolve({ _tag: "Success", value: undefined });
194+
});
195+
setup.startInstall.mockReturnValueOnce(command);
193196
await using screen = await renderSetup({ provider: { ...provider, installed: false } });
194197

195198
await screen.click("Install Antigravity");
@@ -208,7 +211,7 @@ describe("Antigravity setup", () => {
208211
await expect
209212
.element(screen.getByRole("button", { name: "Cancel installation" }))
210213
.toBeDisabled();
211-
await act(async () => command.resolve({ _tag: "Success", value: undefined }));
214+
await act(async () => resolveStart());
212215
await expect.element(screen.getByRole("button", { name: "Cancel installation" })).toBeEnabled();
213216
await expect
214217
.element(screen.getByRole("status").filter({ hasText: "Downloading 1.0 MB of 2.0 MB." }))

0 commit comments

Comments
 (0)