refactor(webui): isolate channel pairing workflow

This commit is contained in:
chengyongru authored and chengyongru committed 2026-11-06 13:34:40 +08:00
1 parent 0a654a666d
commit 792d01be03
4 files changed
+527 -490

No files matched your search

+19
View File
@@ -4661,6 +4661,25 @@ describe("App layout", () => {
expect(within(popup).getByText("2 pending")).toBeVisible();
});
it("shows a dismissed pairing request again when its snooze expires", async () => {
vi.useFakeTimers();
mockFetchRoutes({ "/api/settings/pairing": { requests: [{
code: "ABCD-EFGH", channel: "feishu", sender_id: "alice", delivery_status: "sent",
}] } });
render(<App />);
await act(async () => {});
fireEvent.click(within(screen.getByRole("dialog", { name: "Pair account" }))
.getByRole("button", { name: "Close" }));
expect(screen.queryByRole("dialog", { name: "Pair account" })).not.toBeInTheDocument();
await act(async () => { await vi.advanceTimersByTimeAsync(29_999); });
expect(screen.queryByRole("dialog", { name: "Pair account" })).not.toBeInTheDocument();
await act(async () => { await vi.advanceTimersByTimeAsync(1); });
const popup = screen.getByRole("dialog", { name: "Pair account" });
expect(popup).toBeVisible();
expect(within(popup).getByRole("textbox", { name: "Pairing code" })).toBeEnabled();
});
it("shows a recovered pairing reply even after its failure notice was dismissed", async () => {
vi.useFakeTimers();
let delivery_status = "failed";