fix(tests): typing in tests for Context and event typing

This commit is contained in:
can1357
2026-03-14 11:06:00 +01:00
parent 967d8cc05b
commit ea1d76b79e
2 changed files with 5 additions and 7 deletions
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it, vi } from "bun:test";
import { buildAnthropicClientOptions, streamAnthropic } from "../src/providers/anthropic";
import type { Model } from "../src/types";
import type { Context, Model } from "../src/types";
const originalFetch = global.fetch;
@@ -32,9 +32,9 @@ function makeCopilotClaudeModel(): Model<"anthropic-messages"> {
};
}
const testContext = {
const testContext: Context = {
messages: [{ role: "user", content: "hello", timestamp: Date.now() }],
} as const;
};
function getRequestHeader(
input: string | URL | Request,
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, mock, vi } from "bun:test";
import * as path from "node:path";
import { TempDir } from "@oh-my-pi/pi-utils";
import type { AgentSession } from "../src/session/agent-session";
const compactMock = vi.fn();
@@ -133,10 +134,7 @@ describe("AgentSession compaction Copilot initiator attribution", async () => {
}
async function triggerAutoCompaction(
session: {
agent: { emitExternalEvent: (event: unknown) => void };
subscribe: (listener: (event: { type: string }) => void) => () => void;
},
session: Pick<AgentSession, "agent" | "subscribe">,
model: { api: string; provider: string; id: string; contextWindow: number },
) {
const { promise, resolve } = Promise.withResolvers<void>();