(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestEvalUpdateIssueReverted(t *testing.T) { |
| 58 | old := outcomeUpdateGHAPIGet |
| 59 | t.Cleanup(func() { |
| 60 | outcomeUpdateGHAPIGet = old |
| 61 | }) |
| 62 | outcomeUpdateGHAPIGet = func(endpoint string, repo string) (map[string]any, error) { |
| 63 | return map[string]any{ |
| 64 | "title": "Old title", |
| 65 | "body": "Old body", |
| 66 | "state": "open", |
| 67 | }, nil |
| 68 | } |
| 69 | |
| 70 | report := evalUpdateIssue(CreatedItemReport{ |
| 71 | Type: "update_issue", |
| 72 | Number: 12, |
| 73 | Repo: "owner/repo", |
| 74 | BeforeState: map[string]any{ |
| 75 | "title": "Old title", |
| 76 | "body_hash": mutableBodyHash("Old body"), |
| 77 | "state": "open", |
| 78 | }, |
| 79 | AfterState: map[string]any{ |
| 80 | "title": "New title", |
| 81 | "body_hash": mutableBodyHash("New body"), |
| 82 | "state": "closed", |
| 83 | }, |
| 84 | }, "owner/repo") |
| 85 | |
| 86 | assert.Equal(t, OutcomeRejected, report.Result) |
| 87 | assert.Equal(t, OutcomeStatusRejected, report.OutcomeStatus) |
| 88 | assert.Equal(t, EvidenceStrong, report.EvidenceStrength) |
| 89 | assert.Equal(t, "state_reverted", report.Signal) |
| 90 | } |
| 91 | |
| 92 | func TestEvalUpdatePullRequestRetainedAndMerged(t *testing.T) { |
| 93 | old := outcomeUpdateGHAPIGet |
nothing calls this directly
no test coverage detected