diff options
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/dbstore_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/dbstore/dbstore_test.go b/dbstore/dbstore_test.go index 524fecb..1f98150 100644 --- a/dbstore/dbstore_test.go +++ b/dbstore/dbstore_test.go @@ -1461,3 +1461,34 @@ func TestAddCisaCatalogs(t *testing.T) { // TODO: TestCisaSearch() // test db: dbstore/testdata/mock-testcisasearch.db // test cases: "wordpad" (1 result), "microsoft excel" (4 results) +func TestCisaSearch(t *testing.T) { + ctx := context.Background() + + tests := []struct { + val string + exp []CisaSearchRow + } {{ + val: "wordpad", + exp: []CisaSearchRow { + CisaSearchRow { + }, + }, + }} + + // connect to test db + db, err := Open("testdata/mock-cisasearch.db") + if err != nil { + t.Error(err) + return + } + + for _, test := range(tests) { + t.Run(test.val, func(t *testing.T) { + if got, err := db.CisaSearch(ctx, test.val); err != nil { + t.Error(err) + } else if !reflect.DeepEqual(got, test.exp) { + t.Errorf("got %v, exp %v", got, test.exp ) + } + }) + } +} |