MCPcopy Create free account
hub / github.com/github/gh-aw / TestEvalUpdateIssueRetained

Function TestEvalUpdateIssueRetained

pkg/cli/outcome_eval_update_test.go:11–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestEvalUpdateIssueRetained(t *testing.T) {
12 old := outcomeUpdateGHAPIGet
13 t.Cleanup(func() {
14 outcomeUpdateGHAPIGet = old
15 })
16 outcomeUpdateGHAPIGet = func(endpoint string, repo string) (map[string]any, error) {
17 return map[string]any{
18 "title": "New title",
19 "body": "New body",
20 "state": "open",
21 "labels": []any{
22 map[string]any{"name": "bug"},
23 map[string]any{"name": "triage"},
24 },
25 "assignees": []any{
26 map[string]any{"login": "octo"},
27 },
28 }, nil
29 }
30
31 report := evalUpdateIssue(CreatedItemReport{
32 Type: "update_issue",
33 Number: 12,
34 Repo: "owner/repo",
35 BeforeState: map[string]any{
36 "title": "Old title",
37 "body_hash": mutableBodyHash("Old body"),
38 "state": "open",
39 "labels": []any{"triage"},
40 "assignees": []any{},
41 },
42 AfterState: map[string]any{
43 "title": "New title",
44 "body_hash": mutableBodyHash("New body"),
45 "state": "open",
46 "labels": []any{"triage", "bug"},
47 "assignees": []any{"octo"},
48 },
49 }, "owner/repo")
50
51 assert.Equal(t, OutcomeAccepted, report.Result)
52 assert.Equal(t, OutcomeStatusAccepted, report.OutcomeStatus)
53 assert.Equal(t, EvidenceMedium, report.EvidenceStrength)
54 assert.Equal(t, "state_retained", report.Signal)
55}
56
57func TestEvalUpdateIssueReverted(t *testing.T) {
58 old := outcomeUpdateGHAPIGet

Callers

nothing calls this directly

Calls 2

evalUpdateIssueFunction · 0.85
mutableBodyHashFunction · 0.85

Tested by

no test coverage detected