-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
embedding_test.go
52 lines (46 loc) · 1.11 KB
/
embedding_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package subdir
import (
"testing"
"github.com/99designs/gqlgen/_examples/embedding/subdir/gendir"
"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/stretchr/testify/require"
)
func TestEmbeddingWorks(t *testing.T) {
c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: &Resolver{}})))
var resp struct {
InSchemadir string
Parentdir string
Subdir string
}
c.MustPost(`{
inSchemadir
parentdir
subdir
}
`, &resp)
require.Equal(t, "example", resp.InSchemadir)
require.Equal(t, "example", resp.Parentdir)
require.Equal(t, "example", resp.Subdir)
}
func TestEmbeddingWorksInGendir(t *testing.T) {
c := client.New(
handler.NewDefaultServer(
gendir.NewExecutableSchema(gendir.Config{Resolvers: &GendirResolver{}}),
),
)
var resp struct {
InSchemadir string
Parentdir string
Subdir string
}
c.MustPost(`{
inSchemadir
parentdir
subdir
}
`, &resp)
require.Equal(t, "example", resp.InSchemadir)
require.Equal(t, "example", resp.Parentdir)
require.Equal(t, "example", resp.Subdir)
}