mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
test: guard agent auth bash mock calls
This commit is contained in:
@@ -96,7 +96,7 @@ describe("auth external oauth helpers", () => {
|
||||
});
|
||||
|
||||
const resolveParams = requireRecord(
|
||||
resolveExternalAuthProfilesWithPluginsMock.mock.calls[0]?.[0],
|
||||
resolveExternalAuthProfilesWithPluginsMock.mock.calls.at(0)?.[0],
|
||||
"resolve external auth params",
|
||||
);
|
||||
expect(resolveParams.config).toBe(cfg);
|
||||
|
||||
@@ -29,7 +29,7 @@ describe("logAuthProfileFailureStateChange", () => {
|
||||
now: 1_700_000_000_000,
|
||||
});
|
||||
|
||||
const consoleLine = warnSpy.mock.calls[0]?.[0];
|
||||
const consoleLine = warnSpy.mock.calls.at(0)?.[0];
|
||||
expect(typeof consoleLine).toBe("string");
|
||||
expect(consoleLine).toContain("runId=run-1 forged entry test");
|
||||
expect(consoleLine).toContain("provider=openai]8;;https://evil.test");
|
||||
|
||||
@@ -876,7 +876,7 @@ describe("markAuthProfileFailure — WHAM-aware Codex cooldowns", () => {
|
||||
await markCodexFailureAt({ store, now });
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
const [url, init] = fetchMock.mock.calls.at(0) as [string, RequestInit];
|
||||
expect(url).toBe("https://chatgpt.com/backend-api/wham/usage");
|
||||
expect(init.method).toBe("GET");
|
||||
const headers = init.headers as Record<string, string>;
|
||||
|
||||
@@ -250,7 +250,7 @@ describe("exec PATH login shell merge", () => {
|
||||
|
||||
expect(entries).toEqual(["/usr/bin"]);
|
||||
expect(shellPathMock).toHaveBeenCalledTimes(1);
|
||||
const shellPathCall = shellPathMock.mock.calls[0]?.[0];
|
||||
const shellPathCall = shellPathMock.mock.calls.at(0)?.[0];
|
||||
expect(shellPathCall?.env).toBe(process.env);
|
||||
expect(shellPathCall?.timeoutMs).toBe(1234);
|
||||
} finally {
|
||||
|
||||
@@ -400,7 +400,9 @@ async function expectNotifyOnExitWake(tool: ExecToolInstance, expected: Record<s
|
||||
);
|
||||
try {
|
||||
await startBackgroundCommand(tool, shellEcho("notify"));
|
||||
await expect.poll(() => wakeHandler.mock.calls[0]?.[0], NOTIFY_POLL_OPTIONS).toEqual(expected);
|
||||
await expect
|
||||
.poll(() => wakeHandler.mock.calls.at(0)?.[0], NOTIFY_POLL_OPTIONS)
|
||||
.toEqual(expected);
|
||||
} finally {
|
||||
dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user