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 / fixtures / backend-of / stub-backend-of.ts
18 lines · 637 BRaw
1import type { Backend } from '../../../hooks/backend'
2import Git from '../../../hooks/git'
3
4/**
5 * A backend that holds a working copy at a toplevel and fetches nothing,
6 * its lister word the toplevel so a test can tell which probe pinned.
7 *
8 * @param toplevel the working copy's root
9 * @returns the backend
10 */
11export const stubBackendOf = (toplevel: string): Backend => ({
12 repository: { toplevel },
13 baseModes: ['uncommitted'],
14 words: { ...Git.GIT_WORDS, lister: toplevel },
15 fetchDiff: () => Promise.resolve({ kind: 'unavailable' }),
16 fetchHunks: () => Promise.resolve(new Map()),
17 headKeyOf: () => Promise.resolve(''),
18})