Skip to content
Source
Sign inSign up

relayClientInstallDialog.test.ts

39 lines1.4 KB

1import { beforeEach, describe, expect, it } from "vite-plus/test";
2​
3import {
4 RelayClientInstallConfirmationConflictError,
5 reportRelayClientInstallProgress,
6 requestRelayClientInstallConfirmation,
7 resetRelayClientInstallDialogForTests,
8 respondToRelayClientInstallConfirmation,
9} from "./relayClientInstallDialog";
10​
11describe("relay client install dialog coordinator", () => {
12 beforeEach(() => {
13 resetRelayClientInstallDialogForTests();
14 });
15​
16 it("rejects concurrent confirmation with the active install state", async () => {
17 const confirmation = requestRelayClientInstallConfirmation("2026.10.0");
18 respondToRelayClientInstallConfirmation(true);
19 await expect(confirmation).resolves.toBe(true);
20 reportRelayClientInstallProgress({ type: "progress", stage: "downloading" });
21​
22 const error = await requestRelayClientInstallConfirmation("2026.11.0").then(
23 () => undefined,
24 (cause: unknown) => cause,
25 );
26​
27 expect(error).toBeInstanceOf(RelayClientInstallConfirmationConflictError);
28 expect(error).toMatchObject({
29 requestedVersion: "2026.11.0",
30 activeVersion: "2026.10.0",
31 activeDialogStatus: "installing",
32 activeInstallStage: "downloading",
33 });
34 expect(error).not.toHaveProperty("cause");
35 expect((error as Error).message).toBe(
36 "Cannot confirm relay client installation 2026.11.0; installation 2026.10.0 has dialog status installing.",
37 );
38 });
39});