(content: string, workspace: WorkspaceConfig = PERMISSIVE_WORKSPACE)
| 65 | } |
| 66 | |
| 67 | function toolWithContent(content: string, workspace: WorkspaceConfig = PERMISSIVE_WORKSPACE) { |
| 68 | const bytes = Buffer.from(content, 'utf8'); |
| 69 | return new ReadTool( |
| 70 | createFakeKaos({ |
| 71 | stat: vi.fn<Kaos['stat']>().mockResolvedValue(REGULAR_FILE_STAT), |
| 72 | readBytes: vi.fn<Kaos['readBytes']>().mockImplementation(async (_path, n) => { |
| 73 | return n === undefined ? bytes : bytes.subarray(0, n); |
| 74 | }), |
| 75 | readLines: vi.fn<Kaos['readLines']>().mockImplementation(readLinesFromContent(content)), |
| 76 | readText: vi.fn<Kaos['readText']>().mockResolvedValue(content), |
| 77 | }), |
| 78 | workspace, |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | describe('ReadTool', () => { |
| 83 | it('exposes current metadata and schema', () => { |
no test coverage detected