MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdWorkdirScanAdd

Function TestCmdWorkdirScanAdd

internal/app/workdir_test.go:198–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

196}
197
198func TestCmdWorkdirScanAdd(t *testing.T) {
199 root := setupArchiveTestEnv(t)
200 db := reopenArchiveTestDB(t, root)
201
202 scanRoot := t.TempDir()
203 repo := filepath.Join(scanRoot, "myrepo")
204 writeFakeGitConfig(t, repo, "git@github.com:x/myrepo.git")
205
206 if rc := cmdWorkdir([]string{"scan", scanRoot, "--add"}); rc != 0 {
207 t.Fatalf("scan --add rc=%d", rc)
208 }
209 w, err := flowdb.GetWorkdir(db, repo)
210 if err != nil {
211 t.Fatalf("get: %v", err)
212 }
213 if !w.GitRemote.Valid || !strings.Contains(w.GitRemote.String, "myrepo.git") {
214 t.Errorf("git_remote not registered: %+v", w.GitRemote)
215 }
216 if !w.Name.Valid || w.Name.String != "myrepo" {
217 t.Errorf("name not registered: %+v", w.Name)
218 }
219}
220
221func TestCmdWorkdirUnknownSubcommand(t *testing.T) {
222 setupArchiveTestEnv(t)

Callers

nothing calls this directly

Calls 5

GetWorkdirFunction · 0.92
setupArchiveTestEnvFunction · 0.85
reopenArchiveTestDBFunction · 0.85
writeFakeGitConfigFunction · 0.85
cmdWorkdirFunction · 0.85

Tested by

no test coverage detected