aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/datamaps/reader_test.go64
-rw-r--r--pkg/datamaps/testdata/test_template2.xlsxbin0 -> 9193 bytes
-rw-r--r--pkg/datamaps/testdata/test_template3.xlsxbin0 -> 9193 bytes
3 files changed, 34 insertions, 30 deletions
diff --git a/pkg/datamaps/reader_test.go b/pkg/datamaps/reader_test.go
index 53aff4a..abe5afc 100644
--- a/pkg/datamaps/reader_test.go
+++ b/pkg/datamaps/reader_test.go
@@ -2,6 +2,7 @@ package datamaps
import (
"os"
+ "reflect"
"testing"
)
@@ -217,33 +218,36 @@ func TestExtract(t *testing.T) {
}
}
-// func TestgetTargetFiles(t *testing.T) {
-// // This is not a suitable test for parameterisation, but doing it this way anyway.
-// type args struct {
-// path string
-// }
-// tests := []struct {
-// name string
-// args args
-// want []string
-// wantErr bool
-// }{
-// {"TestgetTargetFiles",
-// args{"/home/lemon/go/src/github.com/hammerheadlemon/datamaps-go/reader/testdata/"},
-// []string{"/home/lemon/go/src/github.com/hammerheadlemon/datamaps-go/reader/testdata/test_template.xlsx"},
-// false,
-// },
-// }
-// for _, tt := range tests {
-// t.Run(tt.name, func(t *testing.T) {
-// got, err := getTargetFiles(tt.args.path)
-// if (err != nil) != tt.wantErr {
-// t.Errorf("getTargetFiles() error = %v, wantErr %v", err, tt.wantErr)
-// return
-// }
-// if !reflect.DeepEqual(got, tt.want) {
-// t.Errorf("getTargetFiles() = %v, want %v", got, tt.want)
-// }
-// })
-// }
-// }
+func TestGetTargetFiles(t *testing.T) {
+ // This is not a suitable test for parameterisation, but doing it this way anyway.
+ type args struct {
+ path string
+ }
+ tests := []struct {
+ name string
+ args args
+ want []string
+ wantErr bool
+ }{
+ {"Get files in testdata",
+ args{"./testdata/"},
+ []string{"testdata/test_template.xlsx",
+ "testdata/test_template2.xlsx",
+ "testdata/test_template3.xlsx"},
+ false,
+ },
+ }
+ for _, tt := range tests {
+ t.Log("Running the test")
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := getTargetFiles(tt.args.path)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("getTargetFiles() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("getTargetFiles() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
diff --git a/pkg/datamaps/testdata/test_template2.xlsx b/pkg/datamaps/testdata/test_template2.xlsx
new file mode 100644
index 0000000..77ac56f
--- /dev/null
+++ b/pkg/datamaps/testdata/test_template2.xlsx
Binary files differ
diff --git a/pkg/datamaps/testdata/test_template3.xlsx b/pkg/datamaps/testdata/test_template3.xlsx
new file mode 100644
index 0000000..77ac56f
--- /dev/null
+++ b/pkg/datamaps/testdata/test_template3.xlsx
Binary files differ