aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmd/datamaps/main.go6
-rw-r--r--pkg/datamaps/db_test.go9
2 files changed, 9 insertions, 6 deletions
diff --git a/cmd/datamaps/main.go b/cmd/datamaps/main.go
index 9e87869..32b7ce8 100644
--- a/cmd/datamaps/main.go
+++ b/cmd/datamaps/main.go
@@ -58,8 +58,7 @@ func main() {
switch opts.Command {
case "datamap":
- err := datamaps.DatamapToDB(opts)
- if err != nil {
+ if err := datamaps.DatamapToDB(opts); err != nil {
log.Fatal(err)
}
case "setup":
@@ -78,7 +77,6 @@ func main() {
// w.Write([]byte("Hello from datamaps"))
})
log.Println("Starting server on :8080")
- err := http.ListenAndServe(":8080", nil)
- log.Fatal(err)
+ log.Fatal(http.ListenAndServe(":8080", nil))
}
}
diff --git a/pkg/datamaps/db_test.go b/pkg/datamaps/db_test.go
index 029121c..a9988d1 100644
--- a/pkg/datamaps/db_test.go
+++ b/pkg/datamaps/db_test.go
@@ -30,12 +30,17 @@ func TestOpenSQLiteFile(t *testing.T) {
}
func TestDatamapGoesIntoDB(t *testing.T) {
+ 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",
}
- err := DatamapToDB(&opts)
- if err != nil {
+ if err := DatamapToDB(&opts); err != nil {
t.Errorf("Unable to write datamap to database file because %v.", err)
}
}