openclaw/extensions/zalouser/src/channel.setup.test.ts
darkamenosa b31b681088
fix(zalouser): fix setup-only onboarding flow (#49219)
* zalouser: extract shared plugin base to reduce duplication

* fix(zalouser): bump zca-js to 2.1.2 and fix state dir resolution

* fix(zalouser): allow empty allowlist during onboarding and add quickstart DM policy prompt

* fix minor review

* fix(zalouser): restore forceAllowFrom setup flow

* fix(zalouser): default group access to allowlist
2026-03-18 03:33:22 +07:00

36 lines
1.2 KiB
TypeScript

import { mkdtemp, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
import { withEnvAsync } from "../../../test/helpers/extensions/env.js";
import { zalouserSetupPlugin } from "./channel.setup.js";
const zalouserSetupAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
plugin: zalouserSetupPlugin,
wizard: zalouserSetupPlugin.setupWizard!,
});
describe("zalouser setup plugin", () => {
it("builds setup status without an initialized runtime", async () => {
const stateDir = await mkdtemp(path.join(os.tmpdir(), "openclaw-zalouser-setup-"));
try {
await withEnvAsync({ OPENCLAW_STATE_DIR: stateDir }, async () => {
await expect(
zalouserSetupAdapter.getStatus({
cfg: {},
accountOverrides: {},
}),
).resolves.toMatchObject({
channel: "zalouser",
configured: false,
statusLines: ["Zalo Personal: needs QR login"],
});
});
} finally {
await rm(stateDir, { recursive: true, force: true });
}
});
});