summaryrefslogtreecommitdiff
path: root/integration-tests/write_file.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/write_file.test.js
parent2d1a6af890da1e9437cd1a1774e2c7fc7ad32957 (diff)
chore(integration-tests): refactor to typescript (#5645)
Diffstat (limited to 'integration-tests/write_file.test.js')
-rw-r--r--integration-tests/write_file.test.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/integration-tests/write_file.test.js b/integration-tests/write_file.test.js
deleted file mode 100644
index 7809161e..00000000
--- a/integration-tests/write_file.test.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * @license
- * Copyright 2025 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import { test } from 'node:test';
-import { strict as assert } from 'assert';
-import {
- TestRig,
- createToolCallErrorMessage,
- printDebugInfo,
- validateModelOutput,
-} from './test-helper.js';
-
-test('should be able to write a file', async () => {
- const rig = new TestRig();
- await rig.setup('should be able to write a file');
- const prompt = `show me an example of using the write tool. put a dad joke in dad.txt`;
-
- const result = await rig.run(prompt);
-
- const foundToolCall = await rig.waitForToolCall('write_file');
-
- // Add debugging information
- if (!foundToolCall) {
- printDebugInfo(rig, result);
- }
-
- const allTools = rig.readToolLogs();
- assert.ok(
- foundToolCall,
- createToolCallErrorMessage(
- 'write_file',
- allTools.map((t) => t.toolRequest.name),
- result,
- ),
- );
-
- // Validate model output - will throw if no output, warn if missing expected content
- validateModelOutput(result, 'dad.txt', 'Write file test');
-
- const newFilePath = 'dad.txt';
-
- const newFileContent = rig.readFile(newFilePath);
-
- // Add debugging for file content
- if (newFileContent === '') {
- console.error('File was created but is empty');
- console.error(
- 'Tool calls:',
- rig.readToolLogs().map((t) => ({
- name: t.toolRequest.name,
- args: t.toolRequest.args,
- })),
- );
- }
-
- assert.notEqual(newFileContent, '', 'Expected file to have content');
-
- // Log success info if verbose
- if (process.env.VERBOSE === 'true') {
- console.log(
- 'File created successfully with content:',
- newFileContent.substring(0, 100) + '...',
- );
- }
-});