test: type heartbeat overflow model fixtures

This commit is contained in:
Peter Steinberger
2026-04-28 04:38:51 +01:00
parent b1439ca527
commit 0ff60d162c

View File

@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { LiveSessionModelSwitchError } from "../../agents/live-model-switch-error.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { ModelDefinitionConfig } from "../../config/types.models.js";
import { CommandLaneClearedError, GatewayDrainingError } from "../../process/command-queue.js";
import type { TemplateContext } from "../templating.js";
import { SILENT_REPLY_TOKEN } from "../tokens.js";
@@ -25,6 +26,19 @@ const state = vi.hoisted(() => ({
const GENERIC_RUN_FAILURE_TEXT =
"⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.";
function makeTestModel(id: string, contextTokens: number): ModelDefinitionConfig {
return {
id,
name: id,
reasoning: false,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: contextTokens,
contextTokens,
maxTokens: 4096,
};
}
vi.mock("../../agents/pi-embedded.js", () => ({
runEmbeddedPiAgent: (params: unknown) => state.runEmbeddedPiAgentMock(params),
}));
@@ -314,10 +328,12 @@ describe("buildContextOverflowRecoveryText", () => {
models: {
providers: {
openrouter: {
models: [{ id: "qwen3.6-plus", contextTokens: 1_000_000 }],
baseUrl: "https://openrouter.test",
models: [makeTestModel("qwen3.6-plus", 1_000_000)],
},
ollama: {
models: [{ id: "qwen3.5-9b-32k:latest", contextTokens: 32_768 }],
baseUrl: "http://ollama.test",
models: [makeTestModel("qwen3.5-9b-32k:latest", 32_768)],
},
},
},