MCPcopy Create free account
hub / github.com/cli/cli / TestViewRun

Function TestViewRun

pkg/cmd/issue/artifact/view/view_test.go:269–1084  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

267}
268
269func TestViewRun(t *testing.T) {
270 // Markdown rendering reads these, so the operator's settings can't change
271 // the output.
272 t.Setenv("GLAMOUR_STYLE", "")
273 t.Setenv("GH_MDWIDTH", "")
274
275 now := time.Date(2026, 9, 24, 23, 30, 0, 0, time.UTC)
276 at := func(value string) *time.Time {
277 ts, err := time.Parse(time.RFC3339, value)
278 require.NoError(t, err)
279 return &ts
280 }
281 copilot := &client.Actor{ID: 2, Login: "Copilot"}
282 monalisa := &client.Actor{ID: 1, Login: "monalisa"}
283 version := func(number int, name string, actor *client.Actor, savedAt string, body string) client.Version {
284 return client.Version{Version: number, Name: name, Body: body, Actor: actor, CreatedAt: at(savedAt)}
285 }
286
287 // Artifact 2 on the spec's issue 142, with its 12 versions. Version 9
288 // renamed it.
289 const oauthPlanBody = "# OAuth callback plan\n\n1. Register the callback URL.\n2. Wire up `order-history` sync."
290 oauthPlan := &client.ArtifactWithVersions{
291 ID: 6626,
292 Number: 2,
293 Type: "generic",
294 Name: "OAuth callback plan",
295 Body: oauthPlanBody,
296 Creator: copilot,
297 UpdatedByActor: monalisa,
298 CreatedAt: at("2026-09-21T23:00:00Z"),
299 UpdatedAt: at("2026-09-24T21:00:00Z"),
300 URL: "https://github.com/monalisa/monas-cafe/issues/142/artifacts/2",
301 Versions: []client.Version{
302 version(12, "OAuth callback plan", monalisa, "2026-09-24T21:00:00Z", oauthPlanBody),
303 version(11, "OAuth callback plan", copilot, "2026-09-24T18:00:00Z", ""),
304 version(10, "OAuth callback plan", copilot, "2026-09-24T16:00:00Z", ""),
305 version(9, "OAuth callback plan", monalisa, "2026-09-23T21:00:00Z", ""),
306 version(8, "OAuth plan", copilot, "2026-09-23T18:00:00Z", ""),
307 version(7, "OAuth plan", copilot, "2026-09-23T08:00:00Z", ""),
308 version(6, "OAuth plan", copilot, "2026-09-22T22:00:00Z", ""),
309 version(5, "OAuth plan", monalisa, "2026-09-22T20:00:00Z", "# OAuth plan\n\n1. Register the callback URL."),
310 version(4, "OAuth plan", copilot, "2026-09-22T10:00:00Z", ""),
311 version(3, "OAuth plan", copilot, "2026-09-21T23:20:00Z", ""),
312 version(2, "OAuth plan", copilot, "2026-09-21T23:10:00Z", ""),
313 version(1, "OAuth plan", copilot, "2026-09-21T23:00:00Z", "# OAuth plan"),
314 },
315 }
316
317 // Artifact 3 on the spec's issue 142, a link saved once, and its page.
318 const runbookURL = "https://github.com/monalisa/monas-cafe/wiki/OAuth-runbook"
319 const runbookPage = "https://github.com/monalisa/monas-cafe/issues/142/artifacts/3"
320 runbook := &client.ArtifactWithVersions{
321 ID: 6627,
322 Number: 3,
323 Type: "link",
324 Name: "Staging OAuth runbook",
325 Body: runbookURL,
326 Creator: copilot,

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
NewJSONExporterFunction · 0.92
NewWithHostFunction · 0.92
TestFunction · 0.92
NewFunction · 0.92
FullNameFunction · 0.92
versionFunction · 0.85
SetFieldsMethod · 0.80
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
SetColorEnabledMethod · 0.80

Tested by

no test coverage detected