spacehub

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

claude-code / mods / diff / tests / git / probes / repository-of.test.ts
27 lines · 864 BRaw
1import { describe, expect, test, tier } from 'claude-code/testing'
2
3import Fixtures from '../../fixtures'
4
5tier('builtin')
6
7describe('repository-of', () => {
8 test('three absolute lines are the repository', async () => {
9 expect(await Fixtures.probedRepositoryOf(Fixtures.RESOLVED)).toEqual({
10 toplevel: '/r',
11 gitDir: '/r/.git/worktrees/w',
12 commonDir: '/r/.git',
13 })
14
15 expect(await Fixtures.probedRepositoryOf(Fixtures.WINDOWS)).toEqual({
16 toplevel: 'C:/r',
17 gitDir: 'C:/r/.git',
18 commonDir: 'C:/r/.git',
19 })
20 })
21
22 test('a git that echoes the flag, or a relative path: nothing', async () => {
23 expect(await Fixtures.probedRepositoryOf(Fixtures.ECHOED_FLAG)).toBeNull()
24 expect(await Fixtures.probedRepositoryOf(Fixtures.RELATIVE)).toBeNull()
25 expect(await Fixtures.probedRepositoryOf('')).toBeNull()
26 })
27})