Files
old-backend/controllers/companies_controller_test.go
2023-10-13 11:48:14 +02:00

27 lines
485 B
Go

package controllers_test
import (
"fmt"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"gitlab.com/pactual1/backend/shared"
)
func TestListCompanies(t *testing.T) {
ts := runTestServer()
defer ts.Close()
defer shared.CloseDb()
t.Run("it should return 200", func(t *testing.T) {
resp, err := http.Get(fmt.Sprintf("%s/buyers?limit=20", ts.URL))
if err != nil {
t.Fatalf("Expected no error, got %v", err)
}
assert.Equal(t, 200, resp.StatusCode)
})
}