Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ccbrown committed Mar 10, 2024
1 parent 0693e61 commit 9b98469
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions graphql/validator/validate_fragments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ func TestValidateFragmentSpreads(t *testing.T) {
assert.Empty(t, validateSource(t, `{union{... on UnionMember{... on Union{... on UnionObjectA{a}}}}}`))
assert.Len(t, validateSource(t, `{union{... on UnionMember{... on Node{id}}}}`), 1)
})

t.Run("Features", func(t *testing.T) {
assert.Empty(t, validateSource(t, `{experimentalObject{...a}} fragment a on ExperimentalObject { foo }`, "experimentalobject"))
assert.Len(t, validateSource(t, `{experimentalObject{...a}} fragment a on ExperimentalObject { foo }`), 2)
})
}
14 changes: 14 additions & 0 deletions graphql/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ var objectType = &schema.ObjectType{
Name: "Object",
}

var experimentalObjectType = &schema.ObjectType{
Name: "ExperimentalObject",
RequiredFeatures: schema.NewFeatureSet("experimentalobject"),
Fields: map[string]*schema.FieldDefinition{
"foo": {
Type: schema.BooleanType,
},
},
}

var complexInputType = &schema.InputObjectType{
Name: "ComplexInput",
Fields: map[string]*schema.InputValueDefinition{
Expand Down Expand Up @@ -92,6 +102,10 @@ func init() {
Type: schema.BooleanType,
Cost: schema.FieldResolverCost(0),
},
"experimentalObject": {
Type: experimentalObjectType,
RequiredFeatures: schema.NewFeatureSet("experimentalobject"),
},
"booleanArgField": {
Type: schema.BooleanType,
Arguments: map[string]*schema.InputValueDefinition{
Expand Down

0 comments on commit 9b98469

Please sign in to comment.