-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathschema_test.go
More file actions
41 lines (38 loc) · 840 Bytes
/
schema_test.go
File metadata and controls
41 lines (38 loc) · 840 Bytes
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
package graphql
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_typeMapReducer(t *testing.T) {
type args struct {
schema *Schema
typeMap TypeMap
objectType Type
}
tests := []struct {
name string
args args
want TypeMap
wantErr bool
}{
{
name: "failure - interface isn't nil but the concrete value is nil",
args: args{
schema: &Schema{},
typeMap: TypeMap{},
objectType: nil,
},
want: TypeMap{},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := typeMapReducer(tt.args.schema, tt.args.typeMap, tt.args.objectType)
if tt.wantErr {
assert.Error(t, err)
}
assert.Equalf(t, tt.want, got, "typeMapReducer(%v, %v, %v)", tt.args.schema, tt.args.typeMap, tt.args.objectType)
})
}
}