Skip to content

Commit 8bf4d5c

Browse files
committed
test(copilot): fix loadWorkspaceFileTextForPreview mock to return { text } not a bare string
The adapter reads previewBase.text to seed an append/patch base; the mock returned a bare '' so previewBase.text was undefined, making a base-less append fail closed (no file_preview_content). My PR's fail-close change exposed the wrong-shaped mock.
1 parent 6efba10 commit 8bf4d5c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/lib/copilot/request/go/stream.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ vi.mock('@/lib/copilot/tools/server/files/file-preview', async () => {
3434
>('@/lib/copilot/tools/server/files/file-preview')
3535
return {
3636
...actual,
37-
loadWorkspaceFileTextForPreview: vi.fn().mockResolvedValue(''),
37+
// Returns the file's preview base as a `WorkspaceFilePreviewBase` ({ text }), NOT a bare string —
38+
// the adapter reads `previewBase.text` to seed an append/patch base. An empty base ('') is defined,
39+
// so a base-less append doesn't fail closed.
40+
loadWorkspaceFileTextForPreview: vi.fn().mockResolvedValue({ text: '' }),
3841
}
3942
})
4043

0 commit comments

Comments
 (0)