(t *testing.T)
| 48 | } |
| 49 | |
| 50 | func TestRunSessionList_JSON(t *testing.T) { |
| 51 | tmpHome := t.TempDir() |
| 52 | setTestHome(t, tmpHome) |
| 53 | repoDir := t.TempDir() |
| 54 | |
| 55 | sh := session.New(repoDir, "main", "test-model", session.SessionOptions{ |
| 56 | ReviewMode: session.ReviewModeCommit, |
| 57 | DiffCommit: "abc123", |
| 58 | }) |
| 59 | sh.RecordReviewItemDone("a.go", "a.go", "a.go", "fp-a", nil) |
| 60 | sh.Finalize() |
| 61 | |
| 62 | got := captureStdout(t, func() { |
| 63 | if err := runSessionListCompat([]string{"--repo", repoDir, "--json"}); err != nil { |
| 64 | t.Fatalf("runSessionList: %v", err) |
| 65 | } |
| 66 | }) |
| 67 | |
| 68 | var decoded []session.Summary |
| 69 | if err := json.Unmarshal([]byte(got), &decoded); err != nil { |
| 70 | t.Fatalf("unmarshal: %v (out=%q)", err, got) |
| 71 | } |
| 72 | if len(decoded) != 1 || decoded[0].SessionID != sh.SessionID { |
| 73 | t.Fatalf("decoded = %+v", decoded) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func TestRunSessionList_EmptyRepo(t *testing.T) { |
| 78 | tmpHome := t.TempDir() |
nothing calls this directly
no test coverage detected