Skip to content

Commit d685d66

Browse files
committed
Set gist ID by default on all tests
1 parent ef9b75e commit d685d66

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pkg/cmd/gist/view/view_test.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,17 @@ func Test_viewRun(t *testing.T) {
9191
wantErr bool
9292
}{
9393
{
94-
name: "no such gist",
94+
name: "no such gist",
95+
opts: &ViewOptions{
96+
Selector: "1234",
97+
},
9598
wantErr: true,
9699
},
97100
{
98101
name: "one file",
102+
opts: &ViewOptions{
103+
Selector: "1234",
104+
},
99105
gist: &shared.Gist{
100106
Files: map[string]*shared.GistFile{
101107
"cicada.txt": {
@@ -109,6 +115,7 @@ func Test_viewRun(t *testing.T) {
109115
{
110116
name: "filename selected",
111117
opts: &ViewOptions{
118+
Selector: "1234",
112119
Filename: "cicada.txt",
113120
},
114121
gist: &shared.Gist{
@@ -127,6 +134,9 @@ func Test_viewRun(t *testing.T) {
127134
},
128135
{
129136
name: "multiple files, no description",
137+
opts: &ViewOptions{
138+
Selector: "1234",
139+
},
130140
gist: &shared.Gist{
131141
Files: map[string]*shared.GistFile{
132142
"cicada.txt": {
@@ -143,6 +153,9 @@ func Test_viewRun(t *testing.T) {
143153
},
144154
{
145155
name: "multiple files, description",
156+
opts: &ViewOptions{
157+
Selector: "1234",
158+
},
146159
gist: &shared.Gist{
147160
Description: "some files",
148161
Files: map[string]*shared.GistFile{
@@ -161,7 +174,8 @@ func Test_viewRun(t *testing.T) {
161174
{
162175
name: "raw",
163176
opts: &ViewOptions{
164-
Raw: true,
177+
Selector: "1234",
178+
Raw: true,
165179
},
166180
gist: &shared.Gist{
167181
Description: "some files",
@@ -217,10 +231,6 @@ func Test_viewRun(t *testing.T) {
217231
io.SetStdoutTTY(true)
218232
tt.opts.IO = io
219233

220-
if tt.opts.Selector == "" {
221-
tt.opts.Selector = "1234"
222-
}
223-
224234
t.Run(tt.name, func(t *testing.T) {
225235
err := viewRun(tt.opts)
226236
if tt.wantErr {

0 commit comments

Comments
 (0)