summaryrefslogtreecommitdiff
path: root/integration-tests/replace.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/replace.test.js
parent2d1a6af890da1e9437cd1a1774e2c7fc7ad32957 (diff)
chore(integration-tests): refactor to typescript (#5645)
Diffstat (limited to 'integration-tests/replace.test.js')
-rw-r--r--integration-tests/replace.test.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/integration-tests/replace.test.js b/integration-tests/replace.test.js
deleted file mode 100644
index 1ac6f5a4..00000000
--- a/integration-tests/replace.test.js
+++ /dev/null
@@ -1,66 +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, printDebugInfo, validateModelOutput } from './test-helper.js';
-
-test('should be able to replace content in a file', async () => {
- const rig = new TestRig();
- await rig.setup('should be able to replace content in a file');
-
- const fileName = 'file_to_replace.txt';
- const originalContent = 'original content';
- const expectedContent = 'replaced content';
-
- rig.createFile(fileName, originalContent);
- const prompt = `Can you replace 'original' with 'replaced' in the file 'file_to_replace.txt'`;
-
- const result = await rig.run(prompt);
-
- const foundToolCall = await rig.waitForToolCall('replace');
-
- // Add debugging information
- if (!foundToolCall) {
- printDebugInfo(rig, result);
- }
-
- assert.ok(foundToolCall, 'Expected to find a replace tool call');
-
- // Validate model output - will throw if no output, warn if missing expected content
- validateModelOutput(
- result,
- ['replaced', 'file_to_replace.txt'],
- 'Replace content test',
- );
-
- const newFileContent = rig.readFile(fileName);
-
- // Add debugging for file content
- if (newFileContent !== expectedContent) {
- console.error('File content mismatch - Debug info:');
- console.error('Expected:', expectedContent);
- console.error('Actual:', newFileContent);
- console.error(
- 'Tool calls:',
- rig.readToolLogs().map((t) => ({
- name: t.toolRequest.name,
- args: t.toolRequest.args,
- })),
- );
- }
-
- assert.strictEqual(
- newFileContent,
- expectedContent,
- 'File content should be updated correctly',
- );
-
- // Log success info if verbose
- if (process.env.VERBOSE === 'true') {
- console.log('File replaced successfully. New content:', newFileContent);
- }
-});