summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/grep.test.ts
diff options
context:
space:
mode:
authorKalle Ahlström <[email protected]>2025-06-28 17:41:25 +0300
committerGitHub <[email protected]>2025-06-28 14:41:25 +0000
commit9665928860eda07a9645c0c7a985f78ae888f6ee (patch)
treec41dff05bf5fe990b92a9cc29ce93ffcdb21dca4 /packages/core/src/tools/grep.test.ts
parent25cdf9b762a13aa7bbfab363dc1c85bdf2c3fae1 (diff)
chore: add proper pluralization handling for match in grep tool (#2344)
Co-authored-by: Allen Hutchison <[email protected]>
Diffstat (limited to 'packages/core/src/tools/grep.test.ts')
-rw-r--r--packages/core/src/tools/grep.test.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/core/src/tools/grep.test.ts b/packages/core/src/tools/grep.test.ts
index 59eb75a4..ae629a52 100644
--- a/packages/core/src/tools/grep.test.ts
+++ b/packages/core/src/tools/grep.test.ts
@@ -115,38 +115,38 @@ describe('GrepTool', () => {
const params: GrepToolParams = { pattern: 'world' };
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 3 match(es) for pattern "world" in path "."',
+ 'Found 3 matches for pattern "world" in path "."',
);
expect(result.llmContent).toContain('File: fileA.txt');
expect(result.llmContent).toContain('L1: hello world');
expect(result.llmContent).toContain('L2: second line with world');
expect(result.llmContent).toContain('File: sub/fileC.txt');
expect(result.llmContent).toContain('L1: another world in sub dir');
- expect(result.returnDisplay).toBe('Found 3 matche(s)');
+ expect(result.returnDisplay).toBe('Found 3 matches');
});
it('should find matches in a specific path', async () => {
const params: GrepToolParams = { pattern: 'world', path: 'sub' };
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 1 match(es) for pattern "world" in path "sub"',
+ 'Found 1 match for pattern "world" in path "sub"',
);
expect(result.llmContent).toContain('File: fileC.txt'); // Path relative to 'sub'
expect(result.llmContent).toContain('L1: another world in sub dir');
- expect(result.returnDisplay).toBe('Found 1 matche(s)');
+ expect(result.returnDisplay).toBe('Found 1 match');
});
it('should find matches with an include glob', async () => {
const params: GrepToolParams = { pattern: 'hello', include: '*.js' };
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 1 match(es) for pattern "hello" in path "." (filter: "*.js")',
+ 'Found 1 match for pattern "hello" in path "." (filter: "*.js")',
);
expect(result.llmContent).toContain('File: fileB.js');
expect(result.llmContent).toContain(
'L2: function baz() { return "hello"; }',
);
- expect(result.returnDisplay).toBe('Found 1 matche(s)');
+ expect(result.returnDisplay).toBe('Found 1 match');
});
it('should find matches with an include glob and path', async () => {
@@ -161,11 +161,11 @@ describe('GrepTool', () => {
};
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 1 match(es) for pattern "hello" in path "sub" (filter: "*.js")',
+ 'Found 1 match for pattern "hello" in path "sub" (filter: "*.js")',
);
expect(result.llmContent).toContain('File: another.js');
expect(result.llmContent).toContain('L1: const greeting = "hello";');
- expect(result.returnDisplay).toBe('Found 1 matche(s)');
+ expect(result.returnDisplay).toBe('Found 1 match');
});
it('should return "No matches found" when pattern does not exist', async () => {
@@ -181,7 +181,7 @@ describe('GrepTool', () => {
const params: GrepToolParams = { pattern: 'foo.*bar' }; // Matches 'const foo = "bar";'
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 1 match(es) for pattern "foo.*bar" in path "."',
+ 'Found 1 match for pattern "foo.*bar" in path "."',
);
expect(result.llmContent).toContain('File: fileB.js');
expect(result.llmContent).toContain('L1: const foo = "bar";');
@@ -191,7 +191,7 @@ describe('GrepTool', () => {
const params: GrepToolParams = { pattern: 'HELLO' };
const result = await grepTool.execute(params, abortSignal);
expect(result.llmContent).toContain(
- 'Found 2 match(es) for pattern "HELLO" in path "."',
+ 'Found 2 matches for pattern "HELLO" in path "."',
);
expect(result.llmContent).toContain('File: fileA.txt');
expect(result.llmContent).toContain('L1: hello world');