dal/pkg/server/handler_test.go
Anton Nesterov 8fd9a369d1
[wip] server
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-14 14:02:20 +02:00

28 lines
454 B
Go

package server
import (
"bytes"
"fmt"
"net/http"
"net/http/httptest"
"testing"
"l12.xyz/dal/adapter"
)
func TestQueryHandler(t *testing.T) {
body := []byte(`{
"something": "wrong",
}`)
req, err := http.NewRequest("POST", "/", bytes.NewBuffer(body))
if err != nil {
t.Fatal(err)
}
rr := httptest.NewRecorder()
handler := QueryHandler(adapter.DBAdapter{
Type: "sqlite3",
})
handler.ServeHTTP(rr, req)
fmt.Println(rr.Code == 400)
}