Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,20 +487,22 @@ describe("Switchify PC shell", () => {
stateHandler = handler;
return () => undefined;
});
const markShown = vi.spyOn(api, "markSetupShown");

render(<App />);
await screen.findByRole("dialog", { name: "Pairing requests" });
expect(screen.queryByRole("dialog", { name: "Input access" })).not.toBeInTheDocument();
expect(screen.getByLabelText("Verification code for Galaxy")).toHaveTextContent("063781");
// Let the auto-open state response settle first, so it cannot land after the cancellation and restore the pairing.
await waitFor(() => expect(markShown).toHaveBeenCalled());
await act(() => markShown.mock.results[0].value);

act(() => stateHandler?.({
...structuredClone(browserState),
pendingPairings: [],
lastActivity: { kind: "info", message: "Pairing request cancelled." },
}));
browserState.pendingPairings = [];
browserState.lastActivity = { kind: "info", message: "Pairing request cancelled." };
act(() => stateHandler?.(structuredClone(browserState)));

await waitFor(() => expect(screen.queryByLabelText("Verification code for Galaxy")).not.toBeInTheDocument());
expect(await screen.findByRole("dialog", { name: "Input access" })).toBeInTheDocument();
expect(screen.queryByLabelText("Verification code for Galaxy")).not.toBeInTheDocument();
});

it("creates a profile and records a desired key", async () => {
Expand Down
Loading