mirror of https://github.com/openclaw/openclaw.git
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import {
|
|
createPluginSetupWizardConfigure,
|
|
createTestWizardPrompter,
|
|
runSetupWizardConfigure,
|
|
type WizardPrompter,
|
|
} from "../../../test/helpers/extensions/setup-wizard.js";
|
|
import type { OpenClawConfig } from "../api.js";
|
|
import { linePlugin } from "./channel.js";
|
|
|
|
const lineConfigure = createPluginSetupWizardConfigure(linePlugin);
|
|
|
|
describe("line setup wizard", () => {
|
|
it("configures token and secret for the default account", async () => {
|
|
const prompter = createTestWizardPrompter({
|
|
text: vi.fn(async ({ message }: { message: string }) => {
|
|
if (message === "Enter LINE channel access token") {
|
|
return "line-token";
|
|
}
|
|
if (message === "Enter LINE channel secret") {
|
|
return "line-secret";
|
|
}
|
|
throw new Error(`Unexpected prompt: ${message}`);
|
|
}) as WizardPrompter["text"],
|
|
});
|
|
|
|
const result = await runSetupWizardConfigure({
|
|
configure: lineConfigure,
|
|
cfg: {} as OpenClawConfig,
|
|
prompter,
|
|
options: {},
|
|
});
|
|
|
|
expect(result.accountId).toBe("default");
|
|
expect(result.cfg.channels?.line?.enabled).toBe(true);
|
|
expect(result.cfg.channels?.line?.channelAccessToken).toBe("line-token");
|
|
expect(result.cfg.channels?.line?.channelSecret).toBe("line-secret");
|
|
});
|
|
});
|