aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/datamaps/reader_test.go
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-07-26 19:34:48 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-07-26 19:34:48 +0100
commitc89f3b3e5680e06b93ed32c27e8b7632c66c3de9 (patch)
tree5617982e37ac874a1b841106f93f96017a12264a /pkg/datamaps/reader_test.go
parentaafbec18d3619d15b776705f446a894cdfa7861f (diff)
parameterised test for []DatamapLine from DB test
Diffstat (limited to 'pkg/datamaps/reader_test.go')
-rw-r--r--pkg/datamaps/reader_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/datamaps/reader_test.go b/pkg/datamaps/reader_test.go
index 35046cc..ec158a1 100644
--- a/pkg/datamaps/reader_test.go
+++ b/pkg/datamaps/reader_test.go
@@ -110,7 +110,30 @@ func TestDMLSliceFromDatabase(t *testing.T) {
if err := DatamapToDB(&opts); err != nil {
t.Errorf("Unable to write datamap to database file because %v.", err)
}
+
+ cases := []struct {
+ index int
+ key string
+ }{
+ {0, "Project/Programme Name"},
+ {1, "Department"},
+ {2, "Delivery Body"},
+ {3, "Stoogge value"},
+ {4, "DRRDD - IPA ID Number"},
+ {5, "Controls Project ID number"},
+ {6, "Jokey Entry"},
+ {7, "Parrots Name"},
+ }
+
data := DMLFromDB("First Datamap", db)
+
+ for _, c := range cases {
+ got := data[c.index].Key
+ if got != c.key {
+ t.Errorf("The test expected %s but got %s\n", c.key, data[c.index].Key)
+ }
+ }
+
if data[0].Key != "Project/Programme Name" {
t.Errorf("expected to see Project/Programme Name and got %q\n", data[0])
}