-
Notifications
You must be signed in to change notification settings - Fork 13
/
test.go
33 lines (28 loc) · 962 Bytes
/
test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"testing"
"github.com/99designs/gqlgen/graphql"
"github.com/coretrix/hitrix/example/entity"
"github.com/coretrix/hitrix/pkg/test"
"github.com/coretrix/hitrix/service"
"github.com/coretrix/hitrix/service/registry"
)
func createContextMyApp(t *testing.T, projectName string, resolvers graphql.ExecutableSchema, mockGlobalServices []*service.DefinitionGlobal, mockRequestServices []*service.DefinitionRequest) *test.Environment {
defaultGlobalServices := []*service.DefinitionGlobal{
registry.ServiceProviderConfigDirectory("../example/config"),
registry.ServiceDefinitionOrmRegistry(entity.Init),
registry.ServiceDefinitionOrmEngine(),
}
defaultRequestServices := []*service.DefinitionRequest{
registry.ServiceDefinitionOrmEngineForContext(false),
}
return test.CreateAPIContext(t,
projectName,
resolvers,
nil,
defaultGlobalServices,
defaultRequestServices,
mockGlobalServices,
mockRequestServices,
)
}