test: guard agent auth bash mock calls

This commit is contained in:
Peter Steinberger
2026-05-12 08:42:59 +01:00
parent cf885c25df
commit be7ac231b8
5 changed files with 7 additions and 5 deletions
@@ -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");
+1 -1
View File
@@ -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>;
+1 -1
View File
@@ -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 {
+3 -1
View File
@@ -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();
}