(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func 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 | |
| 78 | func TestCmdWorkdirAddRequiresExistingPath(t *testing.T) { |
| 79 | setupArchiveTestEnv(t) |
nothing calls this directly
no test coverage detected