本文整理汇总了Golang中github.com/graphql-go/graphql/testutil.ExpectPassesRule函数的典型用法代码示例。如果您正苦于以下问题:Golang ExpectPassesRule函数的具体用法?Golang ExpectPassesRule怎么用?Golang ExpectPassesRule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExpectPassesRule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestValidate_FieldsOnCorrectType_MetaFieldSelectionOnUnion
func TestValidate_FieldsOnCorrectType_MetaFieldSelectionOnUnion(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment directFieldSelectionOnUnion on CatOrDog {
__typename
}
`)
}
示例2: TestValidate_UniqueArgumentNames_SameArgumentOnTwoDirectives
func TestValidate_UniqueArgumentNames_SameArgumentOnTwoDirectives(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueArgumentNamesRule, `
{
field @directive1(arg: "value") @directive2(arg: "value")
}
`)
}
示例3: TestValidate_AnonymousOperationMustBeAlone_NoOperations
func TestValidate_AnonymousOperationMustBeAlone_NoOperations(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.LoneAnonymousOperationRule, `
fragment fragA on Type {
field
}
`)
}
示例4: TestValidate_KnownArgumentNames_NoArgsOnOptionalArg
func TestValidate_KnownArgumentNames_NoArgsOnOptionalArg(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownArgumentNamesRule, `
fragment noArgOnOptionalArg on Dog {
isHousetrained
}
`)
}
示例5: TestValidate_UniqueArgumentNames_NoArgumentsOnDirective
func TestValidate_UniqueArgumentNames_NoArgumentsOnDirective(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueArgumentNamesRule, `
{
field @directive
}
`)
}
示例6: TestValidate_ProvidedNonNullArguments_DirectiveArguments_IgnoresUnknownDirectives
func TestValidate_ProvidedNonNullArguments_DirectiveArguments_IgnoresUnknownDirectives(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.ProvidedNonNullArgumentsRule, `
{
dog @unknown
}
`)
}
示例7: TestValidate_KnownArgumentNames_IgnoresArgsOfUnknownFields
func TestValidate_KnownArgumentNames_IgnoresArgsOfUnknownFields(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownArgumentNamesRule, `
fragment argOnUnknownField on Dog {
unknownField(unknownArg: SIT)
}
`)
}
示例8: TestValidate_NoCircularFragmentSpreads_DoesNotFalsePositiveOnUnknownFragment
func TestValidate_NoCircularFragmentSpreads_DoesNotFalsePositiveOnUnknownFragment(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.NoFragmentCyclesRule, `
fragment nameFragment on Pet {
...UnknownFragment
}
`)
}
示例9: TestValidate_ScalarLeafs_ValidScalarSelection
func TestValidate_ScalarLeafs_ValidScalarSelection(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.ScalarLeafsRule, `
fragment scalarSelection on Dog {
barks
}
`)
}
示例10: TestValidate_VariableDefaultValuesOfCorrectType_VariablesWithNoDefaultValues
func TestValidate_VariableDefaultValuesOfCorrectType_VariablesWithNoDefaultValues(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.DefaultValuesOfCorrectTypeRule, `
query NullableValues($a: Int, $b: String, $c: ComplexInput) {
dog { name }
}
`)
}
示例11: TestValidate_VariableDefaultValuesOfCorrectType_RequiredVariablesWithoutDefaultValues
func TestValidate_VariableDefaultValuesOfCorrectType_RequiredVariablesWithoutDefaultValues(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.DefaultValuesOfCorrectTypeRule, `
query RequiredValues($a: Int!, $b: String!) {
dog { name }
}
`)
}
示例12: TestValidate_FieldsOnCorrectType_IgnoresFieldsOnUnknownType
func TestValidate_FieldsOnCorrectType_IgnoresFieldsOnUnknownType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment unknownSelection on UnknownType {
unknownField
}
`)
}
示例13: TestValidate_FieldsOnCorrectType_LyingAliasSelection
func TestValidate_FieldsOnCorrectType_LyingAliasSelection(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment lyingAliasSelection on Dog {
name : nickname
}
`)
}
示例14: TestValidate_FieldsOnCorrectType_AliasedInterfaceFieldSelection
func TestValidate_FieldsOnCorrectType_AliasedInterfaceFieldSelection(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment interfaceFieldSelection on Pet {
otherName : name
}
`)
}
示例15: TestValidate_FragmentsOnCompositeTypes_UnionIsValidFragmentType
func TestValidate_FragmentsOnCompositeTypes_UnionIsValidFragmentType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FragmentsOnCompositeTypesRule, `
fragment validFragment on CatOrDog {
__typename
}
`)
}