mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
test(cli): avoid brittle mock call indexing in json-mode checks
This commit is contained in:
@@ -239,10 +239,6 @@ describe("registerPreActionHooks", () => {
|
||||
processArgv: ["node", "openclaw", "config", "set", "gateway.auth.mode", "{bad", "--json"],
|
||||
});
|
||||
|
||||
const firstCall = ensureConfigReadyMock.mock.calls[0]?.[0] as
|
||||
| { suppressDoctorStdout?: boolean }
|
||||
| undefined;
|
||||
expect(firstCall?.suppressDoctorStdout).toBeUndefined();
|
||||
expect(ensureConfigReadyMock).toHaveBeenCalledWith({
|
||||
runtime: runtimeMock,
|
||||
commandPath: ["config", "set"],
|
||||
|
||||
@@ -64,14 +64,9 @@ describe("tryRouteCli", () => {
|
||||
it("does not pass suppressDoctorStdout for routed non-json commands", async () => {
|
||||
await expect(tryRouteCli(["node", "openclaw", "status"])).resolves.toBe(true);
|
||||
|
||||
expect(ensureConfigReadyMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
commandPath: ["status"],
|
||||
}),
|
||||
);
|
||||
const firstCall = ensureConfigReadyMock.mock.calls[0]?.[0] as
|
||||
| { suppressDoctorStdout?: boolean }
|
||||
| undefined;
|
||||
expect(firstCall?.suppressDoctorStdout).toBeUndefined();
|
||||
expect(ensureConfigReadyMock).toHaveBeenCalledWith({
|
||||
runtime: expect.any(Object),
|
||||
commandPath: ["status"],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user