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

Function TestCmdWorkdirAddDetectsGitRemote

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

Source from the content-addressed store, hash-verified

54}
55
56func TestCmdWorkdirAddDetectsGitRemote(t *testing.T) {
57 root := setupArchiveTestEnv(t)
58 db := reopenArchiveTestDB(t, root)
59
60 wdPath := filepath.Join(t.TempDir(), "repo")
61 if err := os.MkdirAll(wdPath, 0o755); err != nil {
62 t.Fatal(err)
63 }
64 writeFakeGitConfig(t, wdPath, "git@github.com:foo/bar.git")
65
66 if rc := cmdWorkdir([]string{"add", wdPath}); rc != 0 {
67 t.Fatalf("add rc=%d", rc)
68 }
69 w, err := flowdb.GetWorkdir(db, wdPath)
70 if err != nil {
71 t.Fatalf("get: %v", err)
72 }
73 if !w.GitRemote.Valid || w.GitRemote.String != "git@github.com:foo/bar.git" {
74 t.Errorf("git_remote: got %+v", w.GitRemote)
75 }
76}
77
78func TestCmdWorkdirAddRequiresExistingPath(t *testing.T) {
79 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