featurebase/sql/handler_test.go
reesporte 48aef0c8a4 add copyright notice back in
```bash
for file in `cat diffys`; do
   printf '%s\n%s\n' "// Copyright 2021 Molecula Corp. All rights reserved." "$(cat $file)" >$file;
done
```
2021-12-10 11:01:04 -06:00

30 lines
736 B
Go

// Copyright 2021 Molecula Corp. All rights reserved.
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
//can be more elaborate later
t.Fatal(err)
}
}