summaryrefslogtreecommitdiff
path: root/integration-tests/file-system.test.js
diff options
context:
space:
mode:
authorJacob Richman <[email protected]>2025-08-12 09:19:09 -0700
committerGitHub <[email protected]>2025-08-12 16:19:09 +0000
commit804c181ac4a3dc1c4971a5b8a643421bbe697f3d (patch)
treedc0ae93448453081954da307a91d90dfec9c361a /integration-tests/file-system.test.js
parent2d1a6af890da1e9437cd1a1774e2c7fc7ad32957 (diff)
chore(integration-tests): refactor to typescript (#5645)
Diffstat (limited to 'integration-tests/file-system.test.js')
-rw-r--r--integration-tests/file-system.test.js89
1 files changed, 0 insertions, 89 deletions
diff --git a/integration-tests/file-system.test.js b/integration-tests/file-system.test.js
deleted file mode 100644
index d43f047f..00000000
--- a/integration-tests/file-system.test.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * @license
- * Copyright 2025 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import { strict as assert } from 'assert';
-import { test } from 'node:test';
-import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js';
-
-test('should be able to read a file', async () => {
- const rig = new TestRig();
- await rig.setup('should be able to read a file');
- rig.createFile('test.txt', 'hello world');
-
- const result = await rig.run(
- `read the file test.txt and show me its contents`,
- );
-
- const foundToolCall = await rig.waitForToolCall('read_file');
-
- // Add debugging information
- if (!foundToolCall || !result.includes('hello world')) {
- printDebugInfo(rig, result, {
- 'Found tool call': foundToolCall,
- 'Contains hello world': result.includes('hello world'),
- });
- }
-
- assert.ok(foundToolCall, 'Expected to find a read_file tool call');
-
- // Validate model output - will throw if no output, warn if missing expected content
- validateModelOutput(result, 'hello world', 'File read test');
-});
-
-test('should be able to write a file', async () => {
- const rig = new TestRig();
- await rig.setup('should be able to write a file');
- rig.createFile('test.txt', '');
-
- const result = await rig.run(`edit test.txt to have a hello world message`);
-
- // Accept multiple valid tools for editing files
- const foundToolCall = await rig.waitForAnyToolCall([
- 'write_file',
- 'edit',
- 'replace',
- ]);
-
- // Add debugging information
- if (!foundToolCall) {
- printDebugInfo(rig, result);
- }
-
- assert.ok(
- foundToolCall,
- 'Expected to find a write_file, edit, or replace tool call',
- );
-
- // Validate model output - will throw if no output
- validateModelOutput(result, null, 'File write test');
-
- const fileContent = rig.readFile('test.txt');
-
- // Add debugging for file content
- if (!fileContent.toLowerCase().includes('hello')) {
- const writeCalls = rig
- .readToolLogs()
- .filter((t) => t.toolRequest.name === 'write_file')
- .map((t) => t.toolRequest.args);
-
- printDebugInfo(rig, result, {
- 'File content mismatch': true,
- 'Expected to contain': 'hello',
- 'Actual content': fileContent,
- 'Write tool calls': JSON.stringify(writeCalls),
- });
- }
-
- assert.ok(
- fileContent.toLowerCase().includes('hello'),
- 'Expected file to contain hello',
- );
-
- // Log success info if verbose
- if (process.env.VERBOSE === 'true') {
- console.log('File written successfully with hello message.');
- }
-});