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

Function TestArtifactWithVersionsExportData

pkg/cmd/issue/artifact/client/types_test.go:90–202  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestArtifactWithVersionsExportData(t *testing.T) {
91 createdAt := time.Date(2026, 9, 21, 23, 0, 0, 0, time.UTC)
92 updatedAt := time.Date(2026, 9, 24, 21, 0, 0, 0, time.UTC)
93
94 full := ArtifactWithVersions{
95 ID: 6626,
96 Number: 2,
97 Type: "generic",
98 Name: "OAuth callback plan",
99 Body: "# OAuth callback plan",
100 BodyHTML: "<h1>OAuth callback plan</h1>",
101 Description: "Register the callback URL.",
102 Creator: &Actor{ID: 2, Login: "hubot"},
103 UpdatedByActor: &Actor{ID: 1, Login: "monalisa"},
104 CreatedAt: &createdAt,
105 UpdatedAt: &updatedAt,
106 URL: "https://github.com/monalisa/monas-cafe/issues/142/artifacts/2",
107 Versions: []Version{
108 {
109 Version: 2,
110 Name: "OAuth callback plan",
111 Body: "# OAuth callback plan",
112 BodyHTML: "<h1>OAuth callback plan</h1>",
113 CreatedAt: &updatedAt,
114 Actor: &Actor{ID: 1, Login: "monalisa"},
115 },
116 {
117 Version: 1,
118 Name: "OAuth plan",
119 Body: "# OAuth plan",
120 BodyHTML: "<h1>OAuth plan</h1>",
121 CreatedAt: &createdAt,
122 Actor: &Actor{ID: 2, Login: "hubot"},
123 },
124 },
125 }
126
127 tests := []struct {
128 name string
129 artifact ArtifactWithVersions
130 fields []string
131 wantJSON string
132 }{
133 {
134 name: "every field, with versions newest first",
135 artifact: full,
136 fields: ArtifactWithVersionsFields,
137 wantJSON: `{
138 "body": "# OAuth callback plan",
139 "bodyHtml": "<h1>OAuth callback plan</h1>",
140 "createdAt": "2026-09-21T23:00:00Z",
141 "creator": {"id": 2, "login": "hubot"},
142 "description": "Register the callback URL.",
143 "id": 6626,
144 "name": "OAuth callback plan",
145 "number": 2,
146 "type": "generic",
147 "updatedAt": "2026-09-24T21:00:00Z",

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
ExportDataMethod · 0.65

Tested by

no test coverage detected