MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / setupTestRepo

Function setupTestRepo

projects/electron/src/modules/code/git.test.ts:123–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121
122// Setup test repository with subdirectories
123async function setupTestRepo() {
124 await fs.ensureDir(TEST_REPO_DIR)
125 await fs.ensureDir(TEST_SUBDIR)
126
127 // Initialize git repo
128 gitExec("git init")
129 gitExec('git config user.email "test@bearly.ai"')
130 gitExec('git config user.name "Test User"')
131
132 // Create files at different levels
133 await fs.writeFile(path.join(TEST_REPO_DIR, "root-file.txt"), "Root level file")
134 await fs.ensureDir(path.join(TEST_REPO_DIR, "subdir"))
135 await fs.writeFile(path.join(TEST_REPO_DIR, "subdir", "subdir-file.txt"), "Subdirectory file")
136 await fs.writeFile(path.join(TEST_SUBDIR, "nested-file.txt"), "Nested file")
137
138 // Commit files
139 gitExec("git add .")
140 gitExec('git commit -m "Initial commit"')
141
142 // Create main branch explicitly (some git versions use master)
143 try {
144 gitExec("git branch -M main")
145 } catch {
146 // Already on main
147 }
148}
149
150// Cleanup test directory
151async function cleanupTestRepo() {

Callers 1

git.test.tsFile · 0.85

Calls 2

gitExecFunction · 0.85
writeFileMethod · 0.80

Tested by

no test coverage detected