Skip to content

Commit feaa633

Browse files
j15zclaude
andcommitted
test(copilot): cover directory-scoped docs grep at the handler level
The vfs handler test still pinned the retired single-page restriction; directory grep now succeeds with a parallel page fan-out, and an invalid path (neither page nor directory) is the remaining rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c8069d9 commit feaa633

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

apps/sim/lib/copilot/tools/handlers/vfs.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ describe('vfs handlers docs corpus routing', () => {
746746
expect(fetchMock).not.toHaveBeenCalled()
747747
})
748748

749-
it('greps exactly one docs page and rejects multi-page scopes verbatim', async () => {
749+
it('greps one docs page or a docs directory without touching the workspace VFS', async () => {
750750
fetchMock.mockResolvedValue({
751751
ok: true,
752752
status: 200,
@@ -756,9 +756,16 @@ describe('vfs handlers docs corpus routing', () => {
756756
const single = await executeVfsGrep({ pattern: 'cron', path: DOCS_PAGE }, GREP_CTX)
757757
expect(single.success).toBe(true)
758758

759-
const multi = await executeVfsGrep({ pattern: 'cron', path: 'docs/workflows' }, GREP_CTX)
760-
expect(multi.success).toBe(false)
761-
expect(multi.error).toContain('single page')
759+
const multi = await executeVfsGrep(
760+
{ pattern: 'cron', path: 'docs/workflows', maxResults: 10_000 },
761+
GREP_CTX
762+
)
763+
expect(multi.success).toBe(true)
764+
expect(fetchMock.mock.calls.length).toBeGreaterThan(1)
765+
766+
const invalid = await executeVfsGrep({ pattern: 'cron', path: 'docs/not-a-page.mdx' }, GREP_CTX)
767+
expect(invalid.success).toBe(false)
768+
expect(invalid.error).toContain('not a docs page or directory')
762769
expect(getOrMaterializeVFS).not.toHaveBeenCalled()
763770
})
764771

0 commit comments

Comments
 (0)