Skip to content

Commit

Permalink
fix TestFindAllDirectories unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Kanchwala committed Aug 13, 2020
1 parent 34fa426 commit ab2f8d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/utils/path_test.go
Expand Up @@ -17,7 +17,6 @@
package utils

import (
"fmt"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -90,12 +89,6 @@ func TestFindAllDirectories(t *testing.T) {
want: []string{"./testdata/emptydir"},
wantErr: nil,
},
{
name: "invalid dir",
basePath: "./testdata/nothere",
want: []string{},
wantErr: fmt.Errorf("lstat ./testdata/nothere: no such file or directory"),
},
}

for _, tt := range table {
Expand All @@ -109,4 +102,12 @@ func TestFindAllDirectories(t *testing.T) {
}
})
}

t.Run("invalid dir", func(t *testing.T) {
basePath := "./testdata/nothere"
_, gotErr := FindAllDirectories(basePath)
if gotErr == nil {
t.Errorf("got no error; error expected")
}
})
}
1 change: 1 addition & 0 deletions pkg/utils/testdata/emptydir/somefile.txt
@@ -0,0 +1 @@
somefile
1 change: 1 addition & 0 deletions pkg/utils/testdata/testdir1/somefile.txt
@@ -0,0 +1 @@
somefile
1 change: 1 addition & 0 deletions pkg/utils/testdata/testdir2/somefile.txt
@@ -0,0 +1 @@
somefile

0 comments on commit ab2f8d7

Please sign in to comment.