Use the mocks for tests and benchmarks.

This commit is contained in:
2024-09-13 21:27:34 +01:00
parent 7a791965ca
commit 50c1033ad1
5 changed files with 126 additions and 158 deletions
+15 -1
View File
@@ -1,6 +1,7 @@
package gql
import (
"net/http/httptest"
"testing"
assertions "github.com/stretchr/testify/assert"
@@ -12,9 +13,22 @@ type Tests struct {
}
var (
assert *assertions.Assertions
assert *assertions.Assertions
mockServer *httptest.Server
)
func (suite *Tests) SetupSuite() {
// Start mock GraphQL server
mockServer = StartMockServer()
}
func (suite *Tests) TearDownSuite() {
// Close the mock server
if mockServer != nil {
mockServer.Close()
}
}
func (suite *Tests) SetupTest() {
assert = assertions.New(suite.T())
}