1package filesystem 2 3import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7) 8 9func TestFindFnamesInDirNonZero(t *testing.T) { 10 foundFiles := FindFnamesInDir("testdata", "project.csv") 11 assert.Equal(t, 1, len(foundFiles), "Number of files found in directory") 12} 13 14func TestFindFnamesInDirMultipleArgs(t *testing.T) { 15 foundFiles := FindFnamesInDir("testdata", "project.csv", "commit.csv") 16 assert.Equal(t, 2, len(foundFiles), "Number of files found in directory") 17} 18 19func TestFindFnamesInDirZero(t *testing.T) { 20 foundFiles := FindFnamesInDir("testdata", "totally_should_not_exist.xyz") 21 assert.Equal(t, 0, len(foundFiles), "Number of files found in directory") 22} 23 24func TestCSVFileToEntities(t *testing.T) { 25 entities, err := CSVFileToEntities( 26 "testdata/project.csv", 27 func(cols []string) (interface{}, error) { 28 return cols, nil 29 }, 30 ) 31 assert.Equal(t, nil, err, "Error should be nil") 32 assert.Equal(t, 670, len(entities), "Entity length should be equal") 33} 34