diff --git a/sql/handler_test.go b/sql/handler_test.go new file mode 100644 index 000000000..a583f3ba3 --- /dev/null +++ b/sql/handler_test.go @@ -0,0 +1,28 @@ +package sql_test + +import ( + "context" + "testing" + + "github.com/molecula/featurebase/v2/sql" + "github.com/molecula/featurebase/v2/test" +) + +func TestHandler(t *testing.T) { + cluster := test.MustRunCluster(t, 1) + defer cluster.Close() + api := cluster.GetNode(0).API + queryStr := "select * from nowhere" + mapper := sql.NewMapper() + query, err := mapper.MapSQL(queryStr) + if err != nil { + t.Fatal("failed to map SQL") + } + handler := sql.NewSelectHandler(api) + _, err = handler.Handle(context.Background(), query) + if err.Error() != "mapping select: handling: nowhere: index not found" { + //expecting it to fail with index not found + t.Fatal(err) + } + +}