diff options
Diffstat (limited to 'packages/core/tests')
| -rw-r--r-- | packages/core/tests/agent/agent.test.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/core/tests/agent/agent.test.ts b/packages/core/tests/agent/agent.test.ts index 5be210a..be5272f 100644 --- a/packages/core/tests/agent/agent.test.ts +++ b/packages/core/tests/agent/agent.test.ts @@ -1,8 +1,18 @@ import { describe, expect, it, vi } from "vitest"; import { z } from "zod"; -import { Agent } from "../../src/agent/agent.js"; import type { AgentConfig } from "../../src/types/index.js"; +// Mock bun:sqlite to avoid Bun-only import in vitest/Node +vi.mock("../../src/db/index.js", () => ({ + getDatabase: vi.fn(() => ({})), +})); + +// Mock the credentials module that depends on the DB +vi.mock("../../src/credentials/claude.js", () => ({ + buildBillingHeaderValue: vi.fn(() => ""), + SYSTEM_IDENTITY: "You are a test agent.", +})); + // Mock the ai module's streamText vi.mock("ai", async () => { const actual = await import("ai"); @@ -20,6 +30,8 @@ vi.mock("@ai-sdk/openai-compatible", () => ({ })), })); +const { Agent } = await import("../../src/agent/agent.js"); + function makeConfig(overrides: Partial<AgentConfig> = {}): AgentConfig { return { model: "test-model", |
