fix(tests): typing in tests for Context and event typing
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user