






















@@ -94,16 +94,21 @@ describe("completion-cli write-state", () => {
9494await program.parseAsync(["completion", "--write-state"], { from: "user" });
95959696const cacheDir = path.join(stateDir, "completions");
97-expect(await fs.readdir(cacheDir)).toEqual(
98-expect.arrayContaining(["openclaw.bash", "openclaw.fish", "openclaw.ps1", "openclaw.zsh"]),
99-);
100-expect(registerSubCliByNameMock).toHaveBeenCalledWith(program, "qa", expect.any(Array), {
101-purpose: "completion",
102-});
97+expect((await fs.readdir(cacheDir)).sort()).toEqual([
98+"openclaw.bash",
99+"openclaw.fish",
100+"openclaw.ps1",
101+"openclaw.zsh",
102+]);
103+expect(registerSubCliByNameMock.mock.calls).toEqual([
104+[program, "qa", process.argv, { purpose: "completion" }],
105+]);
103106expect(registerPluginCliCommandsFromValidatedConfigMock).toHaveBeenCalledTimes(1);
104-expect(stderrWrites).toHaveBeenCalledWith(
105-expect.stringContaining("skipping subcommand `qa` while building completion cache"),
106-);
107+expect(stderrWrites.mock.calls).toEqual([
108+[
109+"[completion] skipping subcommand `qa` while building completion cache: qa scenario pack not found: qa/scenarios/index.md\n",
110+],
111+]);
107112108113await fs.rm(stateDir, { recursive: true, force: true });
109114await fs.rm(homeDir, { recursive: true, force: true });
@@ -128,13 +133,16 @@ describe("completion-cli write-state", () => {
128133129134await program.parseAsync(["completion", "--write-state"], { from: "user" });
130135131-expect(registerSubCliByNameMock).toHaveBeenCalledWith(program, "qa", expect.any(Array), {
132-purpose: "completion",
133-});
136+expect(registerSubCliByNameMock.mock.calls).toEqual([
137+[program, "qa", process.argv, { purpose: "completion" }],
138+]);
134139expect(registerPluginCliCommandsFromValidatedConfigMock).not.toHaveBeenCalled();
135-expect(await fs.readdir(path.join(stateDir, "completions"))).toEqual(
136-expect.arrayContaining(["openclaw.bash", "openclaw.fish", "openclaw.ps1", "openclaw.zsh"]),
137-);
140+expect((await fs.readdir(path.join(stateDir, "completions"))).sort()).toEqual([
141+"openclaw.bash",
142+"openclaw.fish",
143+"openclaw.ps1",
144+"openclaw.zsh",
145+]);
138146} finally {
139147delete process.env[COMPLETION_SKIP_PLUGIN_COMMANDS_ENV];
140148await fs.rm(stateDir, { recursive: true, force: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。