MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / toolWithContent

Function toolWithContent

packages/agent-core/test/tools/read-file.test.ts:39–51  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

37}
38
39function toolWithContent(content: string): ReadTool {
40 const bytes = Buffer.from(content, 'utf8');
41 return new ReadTool(
42 createFakeKaos({
43 stat: vi.fn<Kaos['stat']>().mockResolvedValue(REGULAR_FILE_STAT),
44 readBytes: vi.fn<Kaos['readBytes']>().mockImplementation(async (_path, n) => {
45 return n === undefined ? bytes : bytes.subarray(0, n);
46 }),
47 readLines: vi.fn<Kaos['readLines']>().mockImplementation(readLinesFromContent(content)),
48 }),
49 PERMISSIVE_WORKSPACE,
50 );
51}
52
53describe('ReadTool — total-lines message channel', () => {
54 it('reports the file total in the status message even with a positive line_offset window', async () => {

Callers 1

read-file.test.tsFile · 0.70

Calls 2

createFakeKaosFunction · 0.90
readLinesFromContentFunction · 0.70

Tested by

no test coverage detected