Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions integration-tests/sdk-typescript/tool-control.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,21 @@ describe('Tool Control Parameters (E2E)', () => {
// Should NOT have list_directory since it's not in coreTools
expect(toolNames).not.toContain('list_directory');

// Verify file was actually modified (content changed from original).
// Don't assert on specific wording — the model may paraphrase.
const content = await helper.readFile('test.txt');
expect(content).not.toBe('original content');
// Verify the write_file call itself requested different content
// than the original. Asserting on the tool-call arguments (rather
// than re-reading the file afterwards) avoids flakiness in
// sandboxed environments where the file write may not be
// observable from the test process by the time we check it.
const writeFileCalls = findToolCalls(messages, 'write_file');
expect(writeFileCalls.length).toBeGreaterThan(0);
const writtenContent = writeFileCalls.some((tc) => {
const input = tc.toolUse.input as { content?: string };
return (
typeof input?.content === 'string' &&
input.content !== 'original content'
);
});
expect(writtenContent).toBe(true);
} finally {
await q.close();
}
Expand Down
Loading