(t *testing.T)
| 196 | } |
| 197 | |
| 198 | func 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 | |
| 221 | func TestCmdWorkdirUnknownSubcommand(t *testing.T) { |
| 222 | setupArchiveTestEnv(t) |
nothing calls this directly
no test coverage detected