(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestCmdArchiveTask(t *testing.T) { |
| 43 | root := setupArchiveTestEnv(t) |
| 44 | db := reopenArchiveTestDB(t, root) |
| 45 | |
| 46 | insertTask(t, db, "fix-auth", "Fix Auth", "backlog", "medium", "/tmp/wd", nil) |
| 47 | |
| 48 | if rc := cmdArchive([]string{"fix-auth"}); rc != 0 { |
| 49 | t.Fatalf("archive rc=%d", rc) |
| 50 | } |
| 51 | var archivedAt sql.NullString |
| 52 | if err := db.QueryRow("SELECT archived_at FROM tasks WHERE slug = 'fix-auth'").Scan(&archivedAt); err != nil { |
| 53 | t.Fatalf("select: %v", err) |
| 54 | } |
| 55 | if !archivedAt.Valid || archivedAt.String == "" { |
| 56 | t.Errorf("archived_at not set after archive") |
| 57 | } |
| 58 | |
| 59 | // Unarchive. |
| 60 | if rc := cmdUnarchive([]string{"fix-auth"}); rc != 0 { |
| 61 | t.Fatalf("unarchive rc=%d", rc) |
| 62 | } |
| 63 | if err := db.QueryRow("SELECT archived_at FROM tasks WHERE slug = 'fix-auth'").Scan(&archivedAt); err != nil { |
| 64 | t.Fatalf("select: %v", err) |
| 65 | } |
| 66 | if archivedAt.Valid { |
| 67 | t.Errorf("archived_at still set after unarchive: %+v", archivedAt) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | func TestCmdArchiveProjectDoesNotCascade(t *testing.T) { |
| 72 | root := setupArchiveTestEnv(t) |
nothing calls this directly
no test coverage detected