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