test: align merged fixture contracts

This commit is contained in:
Mathews-Tom
2026-07-08 21:21:20 +05:30
parent 1d67851477
commit 4bbcddfb22
5 changed files with 17 additions and 8 deletions
@@ -765,8 +765,8 @@ describe("AuthStorage OAuth login upgrade and multi-account coexistence", () =>
});
expect(authStorage.listStoredCredentials("nvidia").map(entry => entry.credential)).toEqual([
{ type: "api_key", key: "nvapi-first" },
{ type: "api_key", key: "nvapi-second" },
{ type: "api_key", key: "nvapi-first", source: "login" },
{ type: "api_key", key: "nvapi-second", source: "login" },
]);
const selectedKeys = new Set<string>();
+1 -1
View File
@@ -55,7 +55,7 @@ describe("openrouter login wiring", () => {
});
const credential = await storage.get("openrouter");
expect(credential).toEqual({ type: "api_key", key: "sk-or-validated" });
expect(credential).toEqual({ type: "api_key", key: "sk-or-validated", source: "login" });
const authCall = fetchCalls.find(call => call.url.includes("/api/v1/auth/key"));
expect(authCall).toBeDefined();
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
import * as path from "node:path";
import { Agent } from "@oh-my-pi/pi-agent-core";
import { Agent, type AgentTool } from "@oh-my-pi/pi-agent-core";
import type { TextContent } from "@oh-my-pi/pi-ai";
import { AssistantMessageEventStream } from "@oh-my-pi/pi-ai/utils/event-stream";
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
@@ -16,8 +16,17 @@ import {
} from "@oh-my-pi/pi-coding-agent/session/messages";
import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
import { TempDir } from "@oh-my-pi/pi-utils";
import { type } from "arktype";
import { createAssistantMessage } from "./helpers/agent-session-setup";
const mockTaskTool: AgentTool = {
name: "task",
label: "Task",
description: "Mock task tool",
parameters: type({}),
execute: async () => ({ content: [{ type: "text", text: "ok" }] }),
};
type ObservedSkillTurn = {
texts: string[];
};
@@ -43,8 +52,7 @@ describe("AgentSession skill prompt keyword steering", () => {
initialState: {
model,
systemPrompt: ["Test"],
tools: [],
messages: [],
tools: [mockTaskTool],
},
convertToLlm,
streamFn: (_model, context) => {
@@ -67,6 +67,7 @@ function createFixture(streamingMessage?: AssistantMessage) {
const clearPinnedError = vi.fn();
const statusContainer = {
clear: vi.fn(),
disposeChildren: vi.fn(),
addChild: vi.fn(),
};
@@ -283,7 +284,7 @@ describe("EventController working loader reconciliation", () => {
} as Extract<AgentSessionEvent, { type: "auto_compaction_end" }>);
expect(loader?.stop).toHaveBeenCalledTimes(1);
expect(ctx.statusContainer.clear).toHaveBeenCalledTimes(1);
expect(ctx.statusContainer.disposeChildren).toHaveBeenCalledTimes(1);
expect(ctx.flushCompactionQueue).toHaveBeenCalledWith({ willRetry: false });
expect(ctx.ensureLoadingAnimation).toHaveBeenCalledTimes(1);
});
@@ -62,7 +62,7 @@ function makeCtx(): {
const ctx = {
chatContainer: { clear: vi.fn(), addChild: vi.fn() },
pendingMessagesContainer: { clear: vi.fn() },
pendingMessagesContainer: { clear: vi.fn(), disposeChildren: vi.fn() },
pendingBashComponents: [],
pendingPythonComponents: [],
session: { buildTranscriptSessionContext: transcriptSpy },