Skip to content

Commit c8dfd0b

Browse files
committed
test: repair rebase fallout
1 parent adda0be commit c8dfd0b

3 files changed

Lines changed: 28 additions & 10 deletions

File tree

src/agents/auth-profiles/oauth.mirror-refresh.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ function expectPersistedOpenAICodexProfileWithoutInlineTokens(
4242
expect(credential).not.toHaveProperty("idToken");
4343
}
4444

45+
function requireOAuthCredential(store: AuthProfileStore, profileId: string): OAuthCredential {
46+
const profile = store.profiles[profileId];
47+
if (!profile || profile.type !== "oauth") {
48+
throw new Error(`expected OAuth credential for ${profileId}`);
49+
}
50+
return profile;
51+
}
52+
4553
vi.mock("@mariozechner/pi-ai/oauth", () => ({
4654
getOAuthProviders: () => [{ id: "anthropic" }, { id: "openai-codex" }],
4755
getOAuthApiKey: vi.fn(async (provider: string, credentials: Record<string, OAuthCredential>) => {

src/agents/auth-profiles/profiles.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from "node:fs";
22
import os from "node:os";
33
import path from "node:path";
4-
import { describe, expect, it } from "vitest";
4+
import { describe, expect, it, vi } from "vitest";
55
import { resolveOAuthDir } from "../../config/paths.js";
66
import { AUTH_STORE_VERSION } from "./constants.js";
77
import { resolveAuthStorePath } from "./paths.js";
@@ -1261,11 +1261,11 @@ describe("promoteAuthProfileInOrder", () => {
12611261
agentDir,
12621262
);
12631263

1264-
vi.mock("./store.js", () => ({
1265-
ensureAuthProfileStoreForLocalUpdate: vi.fn(() => ({ version: 1, profiles: {} })),
1266-
saveAuthProfileStore: storeMocks.saveAuthProfileStore,
1267-
updateAuthProfileStoreWithLock: storeMocks.updateAuthProfileStoreWithLock,
1268-
}));
1264+
const updated = await promoteAuthProfileInOrder({
1265+
agentDir,
1266+
provider: "openai-codex",
1267+
profileId: newProfileId,
1268+
});
12691269

12701270
expect(updated?.order?.["openai-codex"]).toEqual([newProfileId, staleProfileId]);
12711271
expect(loadAuthProfileStoreForRuntime(agentDir).order?.["openai-codex"]).toEqual([

src/commands/status-all/diagnosis.test.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
import { beforeEach, describe, expect, it, vi } from "vitest";
22
import type { ProgressReporter } from "../../cli/progress.js";
33

4+
type GatewayLogPaths = {
5+
logDir: string;
6+
stdoutPath: string;
7+
stderrPath: string;
8+
};
9+
410
const restartLogMocks = vi.hoisted(() => ({
5-
resolveGatewayLogPaths: vi.fn(() => {
11+
resolveGatewayLogPaths: vi.fn<() => GatewayLogPaths>(() => {
612
throw new Error("skip log tail");
713
}),
8-
resolveGatewayRestartLogPath: vi.fn(() => "/tmp/gateway-restart.log"),
14+
resolveGatewayRestartLogPath: vi.fn<() => string>(() => "/tmp/gateway-restart.log"),
915
}));
1016

1117
const gatewayMocks = vi.hoisted(() => ({
12-
readFileTailLines: vi.fn(async () => [] as string[]),
13-
summarizeLogTail: vi.fn((lines: string[]) => lines),
18+
readFileTailLines: vi.fn<(filePath: string, maxLines: number) => Promise<string[]>>(
19+
async () => [],
20+
),
21+
summarizeLogTail: vi.fn<(lines: string[], opts?: { maxLines?: number }) => string[]>(
22+
(lines) => lines,
23+
),
1424
}));
1525

1626
vi.mock("../../daemon/restart-logs.js", () => ({

0 commit comments

Comments
 (0)