mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 03:11:12 +00:00
fix: verify ClickClack workspace ids during setup
This commit is contained in:
@@ -212,9 +212,8 @@ describe("ClickClack setup wizard", () => {
|
||||
});
|
||||
|
||||
it("keeps setup saved when workspace resolution fails", async () => {
|
||||
mocks.resolveWorkspaceId.mockRejectedValue(
|
||||
new Error("ClickClack workspace not found: missing"),
|
||||
);
|
||||
mocks.resolveWorkspaceId.mockResolvedValue("wsp_missing");
|
||||
mocks.workspaces.mockResolvedValue([]);
|
||||
const note = vi.fn(async () => undefined);
|
||||
|
||||
await expect(
|
||||
@@ -224,7 +223,7 @@ describe("ClickClack setup wizard", () => {
|
||||
channels: {
|
||||
clickclack: {
|
||||
...configuredAccount.channels.clickclack,
|
||||
workspace: "missing",
|
||||
workspace: "wsp_missing",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -232,7 +231,7 @@ describe("ClickClack setup wizard", () => {
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
expect(note).toHaveBeenCalledWith(
|
||||
'Workspace "missing" was not found. Check the id, slug, or name, list available workspaces, and rerun setup.',
|
||||
'Workspace "wsp_missing" was not found. Check the id, slug, or name, list available workspaces, and rerun setup.',
|
||||
"ClickClack connection check",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -162,10 +162,13 @@ export const clickClackSetupWizard: ChannelSetupWizard = {
|
||||
const workspaceId = await resolveWorkspaceId(client, account.workspace);
|
||||
const workspaces = await client.workspaces();
|
||||
const workspace = workspaces.find((candidate) => candidate.id === workspaceId);
|
||||
if (!workspace) {
|
||||
throw new Error(`ClickClack workspace not found: ${account.workspace}`);
|
||||
}
|
||||
await prompter.note(
|
||||
t("wizard.clickclack.connected", {
|
||||
handle: me.handle,
|
||||
workspace: workspace?.name ?? workspaceId,
|
||||
workspace: workspace.name,
|
||||
}),
|
||||
t("wizard.clickclack.connectionTitle"),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user