25 lines
465 B
Go
25 lines
465 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
import "github.com/gavv/httpexpect/v2"
|
|
|
|
func startServer(t *testing.T) {
|
|
config := ServerConfig{
|
|
Datasource: ":memory:",
|
|
Port: "8080",
|
|
Started: make(chan bool),
|
|
}
|
|
go start(t.Context(), &config)
|
|
<-config.Started
|
|
}
|
|
|
|
func TestGetUsers(t *testing.T) {
|
|
startServer(t)
|
|
e := httpexpect.Default(t, "http://localhost:8080/api")
|
|
e.GET("/users").Expect().
|
|
Status(200).JSON().
|
|
Path("$").Array().Length().IsInt(0)
|
|
}
|