feat: add Nostr channel plugin and onboarding install defaults
Co-authored-by: joelklabo <joelklabo@users.noreply.github.com>
This commit is contained in:
@@ -102,6 +102,52 @@ describe("ensureOnboardingPluginInstalled", () => {
|
||||
expect(result.cfg.plugins?.entries?.zalo?.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it("defaults to local on dev channel when local path exists", async () => {
|
||||
const runtime = makeRuntime();
|
||||
const select = vi.fn(async () => "skip") as WizardPrompter["select"];
|
||||
const prompter = makePrompter({ select });
|
||||
const cfg: ClawdbotConfig = { update: { channel: "dev" } };
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
raw.endsWith(`${path.sep}.git`) || raw.endsWith(`${path.sep}extensions${path.sep}zalo`)
|
||||
);
|
||||
});
|
||||
|
||||
await ensureOnboardingPluginInstalled({
|
||||
cfg,
|
||||
entry: baseEntry,
|
||||
prompter,
|
||||
runtime,
|
||||
});
|
||||
|
||||
const firstCall = select.mock.calls[0]?.[0];
|
||||
expect(firstCall?.initialValue).toBe("local");
|
||||
});
|
||||
|
||||
it("defaults to npm on beta channel even when local path exists", async () => {
|
||||
const runtime = makeRuntime();
|
||||
const select = vi.fn(async () => "skip") as WizardPrompter["select"];
|
||||
const prompter = makePrompter({ select });
|
||||
const cfg: ClawdbotConfig = { update: { channel: "beta" } };
|
||||
vi.mocked(fs.existsSync).mockImplementation((value) => {
|
||||
const raw = String(value);
|
||||
return (
|
||||
raw.endsWith(`${path.sep}.git`) || raw.endsWith(`${path.sep}extensions${path.sep}zalo`)
|
||||
);
|
||||
});
|
||||
|
||||
await ensureOnboardingPluginInstalled({
|
||||
cfg,
|
||||
entry: baseEntry,
|
||||
prompter,
|
||||
runtime,
|
||||
});
|
||||
|
||||
const firstCall = select.mock.calls[0]?.[0];
|
||||
expect(firstCall?.initialValue).toBe("npm");
|
||||
});
|
||||
|
||||
it("falls back to local path after npm install failure", async () => {
|
||||
const runtime = makeRuntime();
|
||||
const note = vi.fn(async () => {});
|
||||
|
||||
Reference in New Issue
Block a user