Skip to content

Commit

Permalink
fix bug in set date tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaslovsky committed Jun 19, 2021
1 parent 257063b commit 255142a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/open/open_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ func TestGetLatestTemplateFile(t *testing.T) {
}

func TestSetDateOpt(t *testing.T) {
templateOpts := templatetest.GetOpts()

type testCase struct {
cmdOpts *commandOptions
files []string
Expand Down Expand Up @@ -292,10 +290,12 @@ func TestSetDateOpt(t *testing.T) {
getFiles := func(dir string) ([]string, error) {
return test.files, nil
}
templateOpts := templatetest.GetOpts()
if test.shouldWarn {
templateOpts.TemplateFileCountThresh = test.warnThresh
}

// test
shouldWarn, err := setDateOpt(test.cmdOpts, templateOpts, getFiles, test.now)
if test.shouldErr {
require.Error(t, err)
Expand All @@ -309,8 +309,6 @@ func TestSetDateOpt(t *testing.T) {
}

func TestSetCopyDateOpt(t *testing.T) {
templateOpts := templatetest.GetOpts()

type testCase struct {
cmdOpts *commandOptions
files []string
Expand Down Expand Up @@ -405,10 +403,12 @@ func TestSetCopyDateOpt(t *testing.T) {
getFiles := func(dir string) ([]string, error) {
return test.files, nil
}
templateOpts := templatetest.GetOpts()
if test.shouldWarn {
templateOpts.TemplateFileCountThresh = test.warnThresh
}

// test
shouldWarn, err := setCopyDateOpt(test.cmdOpts, templateOpts, getFiles, test.now)
if test.shouldErr {
require.Error(t, err)
Expand Down

0 comments on commit 255142a

Please sign in to comment.