mirror of
https://github.com/anthropics/claude-code.git
synced 2026-09-14 19:48:39 +08:00
18be13be81
Squash merge of 4 commits
32 lines
852 B
TypeScript
32 lines
852 B
TypeScript
import { describe, expect, test, tier } from 'claude-code/testing'
|
|
|
|
import Parse from '../../../hooks/git/parse'
|
|
|
|
tier('builtin')
|
|
|
|
describe('parse-shortstat', () => {
|
|
test('files, insertions and deletions; either tail optional', () => {
|
|
expect(
|
|
Parse.parseShortstat(
|
|
' 3 files changed, 10 insertions(+), 2 deletions(-)\n',
|
|
),
|
|
).toEqual({ filesCount: 3, linesAdded: 10, linesRemoved: 2 })
|
|
|
|
expect(Parse.parseShortstat(' 1 file changed, 1 insertion(+)\n')).toEqual({
|
|
filesCount: 1,
|
|
linesAdded: 1,
|
|
linesRemoved: 0,
|
|
})
|
|
|
|
expect(Parse.parseShortstat(' 1 file changed, 4 deletions(-)\n')).toEqual({
|
|
filesCount: 1,
|
|
linesAdded: 0,
|
|
linesRemoved: 4,
|
|
})
|
|
})
|
|
|
|
test('an empty diff prints nothing and parses to null', () => {
|
|
expect(Parse.parseShortstat('')).toBeNull()
|
|
})
|
|
})
|