MCPcopy Index your code
hub / github.com/cli/cli / TestRunExportData

Function TestRunExportData

pkg/cmd/run/shared/shared_test.go:111–222  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestRunExportData(t *testing.T) {
112 oldestStartedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:20:13Z")
113 oldestStepStartedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:20:15Z")
114 oldestStepCompletedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:21:10Z")
115 oldestCompletedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:21:16Z")
116 newestStartedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:20:55Z")
117 newestStepStartedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:21:01Z")
118 newestStepCompletedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:23:10Z")
119 newestCompletedAt, _ := time.Parse(time.RFC3339, "2022-07-20T11:23:16Z")
120
121 tests := []struct {
122 name string
123 fields []string
124 run Run
125 output string
126 }{
127 {
128 name: "exports workflow run's single job",
129 fields: []string{"jobs"},
130 run: Run{
131 Jobs: []Job{
132 {
133 ID: 123456,
134 Status: "completed",
135 Conclusion: "success",
136 Name: "macos",
137 Steps: []Step{
138 {
139 Name: "Checkout",
140 Status: "completed",
141 Conclusion: "success",
142 Number: 1,
143 StartedAt: oldestStepStartedAt,
144 CompletedAt: oldestStepCompletedAt,
145 },
146 },
147 StartedAt: oldestStartedAt,
148 CompletedAt: oldestCompletedAt,
149 URL: "https://example.com/OWNER/REPO/actions/runs/123456",
150 },
151 },
152 },
153 output: `{"jobs":[{"completedAt":"2022-07-20T11:21:16Z","conclusion":"success","databaseId":123456,"name":"macos","startedAt":"2022-07-20T11:20:13Z","status":"completed","steps":[{"completedAt":"2022-07-20T11:21:10Z","conclusion":"success","name":"Checkout","number":1,"startedAt":"2022-07-20T11:20:15Z","status":"completed"}],"url":"https://example.com/OWNER/REPO/actions/runs/123456"}]}`,
154 },
155 {
156 name: "exports workflow run's multiple jobs",
157 fields: []string{"jobs"},
158 run: Run{
159 Jobs: []Job{
160 {
161 ID: 123456,
162 Status: "completed",
163 Conclusion: "success",
164 Name: "macos",
165 Steps: []Step{
166 {
167 Name: "Checkout",
168 Status: "completed",

Callers

nothing calls this directly

Calls 4

EqualMethod · 0.80
RunMethod · 0.65
ExportDataMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected