fix(ci): repair agent test mocks

This commit is contained in:
Vincent Koc
2026-04-13 23:30:17 +01:00
parent 9dc4a270e4
commit a165f7b063
2 changed files with 17 additions and 13 deletions

View File

@@ -7,19 +7,19 @@ const hoisted = vi.hoisted(() => ({
listAgentIdsMock: vi.fn<() => string[]>(),
}));
vi.mock("../../config/sessions.js", async () => {
const actual = await vi.importActual<typeof import("../../config/sessions.js")>(
"../../config/sessions.js",
);
return {
...actual,
loadSessionStore: (storePath: string) => hoisted.loadSessionStoreMock(storePath),
resolveStorePath: (store?: string, params?: { agentId?: string }) =>
`/stores/${params?.agentId ?? "main"}.json`,
resolveAgentIdFromSessionKey: () => "main",
resolveExplicitAgentSessionKey: () => undefined,
};
});
vi.mock("../../config/sessions/store-load.js", () => ({
loadSessionStore: (storePath: string) => hoisted.loadSessionStoreMock(storePath),
}));
vi.mock("../../config/sessions/paths.js", () => ({
resolveStorePath: (_store?: string, params?: { agentId?: string }) =>
`/stores/${params?.agentId ?? "main"}.json`,
}));
vi.mock("../../config/sessions/main-session.js", () => ({
resolveAgentIdFromSessionKey: () => "main",
resolveExplicitAgentSessionKey: () => undefined,
}));
vi.mock("../agent-scope.js", () => ({
listAgentIds: () => hoisted.listAgentIdsMock(),

View File

@@ -21,6 +21,10 @@ vi.mock("./auth-profiles/order.js", () => ({
resolveAuthProfileOrder: vi.fn(),
}));
vi.mock("./auth-profiles/source-check.js", () => ({
hasAnyAuthProfileStoreSource: vi.fn(() => true),
}));
type AuthProfilesStoreModule = typeof import("./auth-profiles/store.js");
type AuthProfilesUsageModule = typeof import("./auth-profiles/usage.js");
type AuthProfilesOrderModule = typeof import("./auth-profiles/order.js");