Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthdsm committed Mar 12, 2024
1 parent 93378b1 commit 492bed4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions utils/nf-cmgg-sampletracking/nf-cmgg-sampletracking_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"testing"
)

func TestFindFilesByExtension(t *testing.T) {
dir := "test-data"
extension := []string{".txt", ".csv"}

files, err := findFilesByExtension(dir, extension)
if err != nil {
t.Errorf("Error finding files: %v", err)
}

expectedFiles := []string{
"test-data/test1.txt",
"test-data/test2.csv",
// Add more expected file paths here
}

if len(files) != len(expectedFiles) {
t.Errorf("Expected %d files, but got %d", len(expectedFiles), len(files))
}

for i, file := range files {
if file != expectedFiles[i] {
t.Errorf("Expected file path %s, but got %s", expectedFiles[i], file)
}
}
}
Empty file.
Empty file.

0 comments on commit 492bed4

Please sign in to comment.