(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func TestWatchRun(t *testing.T) { |
| 112 | failedRunStubs := func(reg *httpmock.Registry) { |
| 113 | inProgressRun := shared.TestRunWithCommit(2, shared.InProgress, "", "commit2") |
| 114 | completedRun := shared.TestRun(2, shared.Completed, shared.Failure) |
| 115 | reg.Register( |
| 116 | httpmock.REST("GET", "repos/OWNER/REPO/actions/runs"), |
| 117 | httpmock.JSONResponse(shared.RunsPayload{ |
| 118 | WorkflowRuns: []shared.Run{ |
| 119 | shared.TestRunWithCommit(1, shared.InProgress, "", "commit1"), |
| 120 | inProgressRun, |
| 121 | }, |
| 122 | })) |
| 123 | reg.Register( |
| 124 | httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/2"), |
| 125 | httpmock.JSONResponse(inProgressRun)) |
| 126 | reg.Register( |
| 127 | httpmock.REST("GET", "runs/2/jobs"), |
| 128 | httpmock.JSONResponse(shared.JobsPayload{ |
| 129 | Jobs: []shared.Job{}})) |
| 130 | reg.Register( |
| 131 | httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/2"), |
| 132 | httpmock.JSONResponse(completedRun)) |
| 133 | reg.Register( |
| 134 | httpmock.REST("GET", "runs/2/jobs"), |
| 135 | httpmock.JSONResponse(shared.JobsPayload{ |
| 136 | Jobs: []shared.Job{ |
| 137 | shared.FailedJob, |
| 138 | }, |
| 139 | })) |
| 140 | reg.Register( |
| 141 | httpmock.REST("GET", "repos/OWNER/REPO/check-runs/20/annotations"), |
| 142 | httpmock.JSONResponse(shared.FailedJobAnnotations)) |
| 143 | reg.Register( |
| 144 | httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows"), |
| 145 | httpmock.JSONResponse(workflowShared.WorkflowsPayload{ |
| 146 | Workflows: []workflowShared.Workflow{ |
| 147 | shared.TestWorkflow, |
| 148 | }, |
| 149 | })) |
| 150 | reg.Register( |
| 151 | httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/123"), |
| 152 | httpmock.JSONResponse(shared.TestWorkflow)) |
| 153 | reg.Register( |
| 154 | httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/123"), |
| 155 | httpmock.JSONResponse(shared.TestWorkflow)) |
| 156 | } |
| 157 | successfulRunStubs := func(reg *httpmock.Registry) { |
| 158 | inProgressRun := shared.TestRunWithCommit(2, shared.InProgress, "", "commit2") |
| 159 | completedRun := shared.TestRun(2, shared.Completed, shared.Success) |
| 160 | reg.Register( |
| 161 | httpmock.REST("GET", "repos/OWNER/REPO/actions/runs"), |
| 162 | httpmock.JSONResponse(shared.RunsPayload{ |
| 163 | WorkflowRuns: []shared.Run{ |
| 164 | shared.TestRunWithCommit(1, shared.InProgress, "", "commit1"), |
| 165 | inProgressRun, |
| 166 | }, |
| 167 | })) |
| 168 | reg.Register( |
nothing calls this directly
no test coverage detected