-
Notifications
You must be signed in to change notification settings - Fork 14
/
test.go
36 lines (30 loc) · 1.04 KB
/
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
34
35
36
package main
import (
"testing"
"github.com/coretrix/hitrix/service/component/app"
"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.ServiceProviderOrmRegistry(entity.Init),
registry.ServiceProviderOrmEngine(),
}
defaultRequestServices := []*service.DefinitionRequest{
registry.ServiceProviderOrmEngineForContext(false),
}
return test.CreateAPIContext(t,
projectName,
resolvers,
nil,
defaultGlobalServices,
defaultRequestServices,
mockGlobalServices,
mockRequestServices,
&app.RedisPools{Cache: "default", Persistent: "default"},
)
}