MCPcopy
hub / github.com/cli/cli / Test_viewRun

Function Test_viewRun

pkg/cmd/release/view/view_test.go:122–282  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

120}
121
122func Test_viewRun(t *testing.T) {
123 oneHourAgo := time.Now().Add(time.Duration(-24) * time.Hour)
124 frozenTime, err := time.Parse(time.RFC3339, "2020-08-31T15:44:24+02:00")
125 require.NoError(t, err)
126
127 tests := []struct {
128 name string
129 isTTY bool
130 releaseBody string
131 releasedAt time.Time
132 opts ViewOptions
133 wantErr string
134 wantStdout string
135 wantStderr string
136 }{
137 {
138 name: "view specific release",
139 isTTY: true,
140 releaseBody: `* Fixed bugs\n`,
141 releasedAt: oneHourAgo,
142 opts: ViewOptions{
143 TagName: "v1.2.3",
144 },
145 wantStdout: heredoc.Doc(`
146 v1.2.3
147 MonaLisa released this about 1 day ago
148
149
150 • Fixed bugs
151
152
153 Assets
154 NAME DIGEST SIZE
155 windows.zip sha256:deadc0de 12 B
156 linux.tgz 34 B
157
158 View on GitHub: https://github.com/OWNER/REPO/releases/tags/v1.2.3
159 `),
160 wantStderr: ``,
161 },
162 {
163 name: "view latest release",
164 isTTY: true,
165 releaseBody: `* Fixed bugs\n`,
166 releasedAt: oneHourAgo,
167 opts: ViewOptions{
168 TagName: "",
169 },
170 wantStdout: heredoc.Doc(`
171 v1.2.3
172 MonaLisa released this about 1 day ago
173
174
175 • Fixed bugs
176
177
178 Assets
179 NAME DIGEST SIZE

Callers

nothing calls this directly

Calls 13

VerifyMethod · 0.95
TestFunction · 0.92
StubFetchReleaseFunction · 0.92
FromFullNameFunction · 0.92
DurationMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
viewRunFunction · 0.70
AddMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected