mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
test: group remaining suite cleanups
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ConfigFileSnapshot, OpenClawConfig } from "../config/types.js";
|
||||
|
||||
/**
|
||||
@@ -53,8 +53,9 @@ function setSnapshot(resolved: OpenClawConfig, config: OpenClawConfig) {
|
||||
mockReadConfigFileSnapshot.mockResolvedValueOnce(buildSnapshot({ resolved, config }));
|
||||
}
|
||||
|
||||
let registerConfigCli: typeof import("./config-cli.js").registerConfigCli;
|
||||
|
||||
async function runConfigCommand(args: string[]) {
|
||||
const { registerConfigCli } = await import("./config-cli.js");
|
||||
const program = new Command();
|
||||
program.exitOverride();
|
||||
registerConfigCli(program);
|
||||
@@ -62,6 +63,10 @@ async function runConfigCommand(args: string[]) {
|
||||
}
|
||||
|
||||
describe("config cli", () => {
|
||||
beforeAll(async () => {
|
||||
({ registerConfigCli } = await import("./config-cli.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
@@ -166,7 +171,6 @@ describe("config cli", () => {
|
||||
});
|
||||
|
||||
it("shows --strict-json and keeps --json as a legacy alias in help", async () => {
|
||||
const { registerConfigCli } = await import("./config-cli.js");
|
||||
const program = new Command();
|
||||
registerConfigCli(program);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user