Skip to content

Commit e7f17f5

Browse files
committed
Fix all test files to use runtimeTempDir and pass runtime parameter
- Replaced all tempDir: with runtimeTempDir: in test files - Added runtime parameter to all streamManager.startStream() calls in tests - Imported createRuntime() and created runtime instance for tests
1 parent 098a02e commit e7f17f5

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

src/services/streamManager.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { HistoryService } from "./historyService";
44
import type { PartialService } from "./partialService";
55
import { createAnthropic } from "@ai-sdk/anthropic";
66
import { shouldRunIntegrationTests, validateApiKeys } from "../../tests/testUtils";
7+
import { createRuntime } from "@/runtime/runtimeFactory";
78

89
// Skip integration tests if TEST_INTEGRATION is not set
910
const describeIntegration = shouldRunIntegrationTests() ? describe : describe.skip;
@@ -85,6 +86,7 @@ describe("StreamManager - Concurrent Stream Prevention", () => {
8586
"anthropic:claude-sonnet-4-5",
8687
1,
8788
"You are a helpful assistant",
89+
runtime,
8890
undefined,
8991
{}
9092
);
@@ -102,6 +104,7 @@ describe("StreamManager - Concurrent Stream Prevention", () => {
102104
"anthropic:claude-sonnet-4-5",
103105
2,
104106
"You are a helpful assistant",
107+
runtime,
105108
undefined,
106109
{}
107110
);

src/services/tools/file_edit_insert.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function createTestFileEditInsertTool(options?: { cwd?: string }) {
2121
const tool = createFileEditInsertTool({
2222
cwd: options?.cwd ?? process.cwd(),
2323
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
24-
tempDir: tempDir.path,
24+
runtimeTempDir: tempDir.path,
2525
});
2626

2727
return {
@@ -214,7 +214,7 @@ describe("file_edit_insert tool", () => {
214214
const tool = createFileEditInsertTool({
215215
cwd: testDir,
216216
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
217-
tempDir: "/tmp",
217+
runtimeTempDir: "/tmp",
218218
});
219219
const args: FileEditInsertToolArgs = {
220220
file_path: nonExistentPath,
@@ -240,7 +240,7 @@ describe("file_edit_insert tool", () => {
240240
const tool = createFileEditInsertTool({
241241
cwd: testDir,
242242
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
243-
tempDir: "/tmp",
243+
runtimeTempDir: "/tmp",
244244
});
245245
const args: FileEditInsertToolArgs = {
246246
file_path: nestedPath,
@@ -267,7 +267,7 @@ describe("file_edit_insert tool", () => {
267267
const tool = createFileEditInsertTool({
268268
cwd: testDir,
269269
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
270-
tempDir: "/tmp",
270+
runtimeTempDir: "/tmp",
271271
});
272272
const args: FileEditInsertToolArgs = {
273273
file_path: testFilePath,

src/services/tools/file_edit_operation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function createConfig() {
99
return {
1010
cwd: TEST_CWD,
1111
runtime: createRuntime({ type: "local", srcBaseDir: TEST_CWD }),
12-
tempDir: "/tmp",
12+
runtimeTempDir: "/tmp",
1313
};
1414
}
1515

src/services/tools/file_edit_replace.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe("file_edit_replace_string tool", () => {
6060
const tool = createFileEditReplaceStringTool({
6161
cwd: testDir,
6262
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
63-
tempDir: "/tmp",
63+
runtimeTempDir: "/tmp",
6464
});
6565

6666
const payload: FileEditReplaceStringToolArgs = {
@@ -98,7 +98,7 @@ describe("file_edit_replace_lines tool", () => {
9898
const tool = createFileEditReplaceLinesTool({
9999
cwd: testDir,
100100
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
101-
tempDir: "/tmp",
101+
runtimeTempDir: "/tmp",
102102
});
103103

104104
const payload: FileEditReplaceLinesToolArgs = {

src/services/tools/file_read.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function createTestFileReadTool(options?: { cwd?: string }) {
2121
const tool = createFileReadTool({
2222
cwd: options?.cwd ?? process.cwd(),
2323
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
24-
tempDir: tempDir.path,
24+
runtimeTempDir: tempDir.path,
2525
});
2626

2727
return {
@@ -335,7 +335,7 @@ describe("file_read tool", () => {
335335
const tool = createFileReadTool({
336336
cwd: subDir,
337337
runtime: createRuntime({ type: "local", srcBaseDir: "/tmp" }),
338-
tempDir: "/tmp",
338+
runtimeTempDir: "/tmp",
339339
});
340340
const args: FileReadToolArgs = {
341341
filePath: "../test.txt", // This goes outside subDir back to testDir

src/services/tools/todo.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { clearTodosForTempDir, getTodosForTempDir, setTodosForTempDir } from "./
66
import type { TodoItem } from "@/types/tools";
77

88
describe("Todo Storage", () => {
9-
let tempDir: string;
9+
let runtimeTempDir: string;
1010

1111
beforeEach(async () => {
1212
// Create a temporary directory for each test

0 commit comments

Comments
 (0)