diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 17:14:25 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 17:14:25 +0100 |
commit | 73e42a5e67c5d166a36bfe1473ef1ec05a761168 (patch) | |
tree | 773bac8128ed876b2381286be9e64a404b014205 /pkg/datamaps/reader_test.go | |
parent | 4c29ab5529faccf927fb48e1883f8ec1b0464a05 (diff) |
adding test and code for pulling []DatamapLine from sqlite3 file
Diffstat (limited to 'pkg/datamaps/reader_test.go')
-rw-r--r-- | pkg/datamaps/reader_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/pkg/datamaps/reader_test.go b/pkg/datamaps/reader_test.go index a0b3ffe..be89e5f 100644 --- a/pkg/datamaps/reader_test.go +++ b/pkg/datamaps/reader_test.go @@ -70,6 +70,50 @@ func TestReadXLSX(t *testing.T) { } } +// func TestExtractWithDBDatamap(t *testing.T) { +// // setup - we need the datamap in the test database +// db, err := SetupDB("./testdata/test.db") +// defer db.Close() + +// if err != nil { +// t.Fatal("Expected to be able to set up the database.") +// } + +// opts := Options{ +// DBPath: "./testdata/test.db", +// DMName: "First Datamap", +// DMPath: "./testdata/datamap.csv", +// } + +// if err := DatamapToDB(&opts); err != nil { +// t.Errorf("Unable to write datamap to database file because %v.", err) +// } + +// d := ExtractDBDM("First Datamap", "testdata/test_template.xlsx") +// } + +func TestDMLSliceFromDatabase(t *testing.T) { + // setup - we need the datamap in the test database + db, err := SetupDB("./testdata/test.db") + defer db.Close() + + if err != nil { + t.Fatal("Expected to be able to set up the database.") + } + + opts := Options{ + DBPath: "./testdata/test.db", + DMName: "First Datamap", + DMPath: "./testdata/datamap.csv", + } + + if err := DatamapToDB(&opts); err != nil { + t.Errorf("Unable to write datamap to database file because %v.", err) + } + data := DMLFromDB("First Datamap", db) + t.Log(data) +} + func TestExtract(t *testing.T) { d := Extract("testdata/datamap.csv", "testdata/test_template.xlsx") cases := []struct { |