From d685d666b2a0b7ee3481b145e875d3c2fdf99264 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Mon, 21 Sep 2020 12:11:08 -0300 Subject: [PATCH] Set gist ID by default on all tests --- pkg/cmd/gist/view/view_test.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pkg/cmd/gist/view/view_test.go b/pkg/cmd/gist/view/view_test.go index c50541a4f..185a2b979 100644 --- a/pkg/cmd/gist/view/view_test.go +++ b/pkg/cmd/gist/view/view_test.go @@ -91,11 +91,17 @@ func Test_viewRun(t *testing.T) { wantErr bool }{ { - name: "no such gist", + name: "no such gist", + opts: &ViewOptions{ + Selector: "1234", + }, wantErr: true, }, { name: "one file", + opts: &ViewOptions{ + Selector: "1234", + }, gist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -109,6 +115,7 @@ func Test_viewRun(t *testing.T) { { name: "filename selected", opts: &ViewOptions{ + Selector: "1234", Filename: "cicada.txt", }, gist: &shared.Gist{ @@ -127,6 +134,9 @@ func Test_viewRun(t *testing.T) { }, { name: "multiple files, no description", + opts: &ViewOptions{ + Selector: "1234", + }, gist: &shared.Gist{ Files: map[string]*shared.GistFile{ "cicada.txt": { @@ -143,6 +153,9 @@ func Test_viewRun(t *testing.T) { }, { name: "multiple files, description", + opts: &ViewOptions{ + Selector: "1234", + }, gist: &shared.Gist{ Description: "some files", Files: map[string]*shared.GistFile{ @@ -161,7 +174,8 @@ func Test_viewRun(t *testing.T) { { name: "raw", opts: &ViewOptions{ - Raw: true, + Selector: "1234", + Raw: true, }, gist: &shared.Gist{ Description: "some files", @@ -217,10 +231,6 @@ func Test_viewRun(t *testing.T) { io.SetStdoutTTY(true) tt.opts.IO = io - if tt.opts.Selector == "" { - tt.opts.Selector = "1234" - } - t.Run(tt.name, func(t *testing.T) { err := viewRun(tt.opts) if tt.wantErr {