surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | import type { Args } from 'claude-code' |
| 2 | import { describe, expect, test, tier } from 'claude-code/testing' |
| 3 | |
| 4 | import Record from '../hooks/record' |
| 5 | import Fixtures from './fixtures' |
| 6 | |
| 7 | tier('builtin') |
| 8 | |
| 9 | describe('record', () => { |
| 10 | test('a read marks how its hunks went, by the same names', async ($, on) => { |
| 11 | let refusal: string | null = null |
| 12 | |
| 13 | const marked = Fixtures.keeping<Args<'telemetry.mark'>>() |
| 14 | |
| 15 | const world = Fixtures.inRepository(on, Fixtures.TWO_FILES, { |
| 16 | hunksRefusal: () => refusal, |
| 17 | }) |
| 18 | |
| 19 | on('telemetry.mark', marked.hook) |
| 20 | on('tool.call', () => ({ result: 'ran' })) |
| 21 | |
| 22 | await $.session.start(Fixtures.SESSION) |
| 23 | await $.command.run(Fixtures.DIFF) |
| 24 | await world.clock.advance(Fixtures.SETTLE_MS) |
| 25 | |
| 26 | refusal = Fixtures.GIT_HUNG |
| 27 | |
| 28 | await $.tool.call({ tool: 'Bash', command: 'make' }) |
| 29 | await world.clock.advance(Fixtures.SETTLE_MS) |
| 30 | |
| 31 | expect( |
| 32 | marked.kept.filter(mark => mark.feature === Record.FEATURES.read), |
| 33 | 'one row a read: the counts came both times, the bodies once', |
| 34 | ).toEqual([ |
| 35 | { feature: 'repl_diff_read', kind: 'ok' }, |
| 36 | { feature: 'repl_diff_read', kind: 'sad', reason: 'git_hunks_failed' }, |
| 37 | ]) |
| 38 | }) |
| 39 | }) |