本文整理匯總了Golang中github.com/housinganywhere/graphql/testutil.ExpectPassesRule函數的典型用法代碼示例。如果您正苦於以下問題:Golang ExpectPassesRule函數的具體用法?Golang ExpectPassesRule怎麽用?Golang ExpectPassesRule使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ExpectPassesRule函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestValidate_FieldsOnCorrectType_AliasedInterfaceFieldSelection
func TestValidate_FieldsOnCorrectType_AliasedInterfaceFieldSelection(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment interfaceFieldSelection on Pet {
otherName : name
}
`)
}
示例2: TestValidate_KnownArgumentNames_DirectiveArgsAreKnown
func TestValidate_KnownArgumentNames_DirectiveArgsAreKnown(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownArgumentNamesRule, `
{
dog @skip(if: true)
}
`)
}
示例3: TestValidate_AnonymousOperationMustBeAlone_OneAnonOperation
func TestValidate_AnonymousOperationMustBeAlone_OneAnonOperation(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.LoneAnonymousOperationRule, `
{
field
}
`)
}
示例4: TestValidate_KnownArgumentNames_SingleArgIsKnown
func TestValidate_KnownArgumentNames_SingleArgIsKnown(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownArgumentNamesRule, `
fragment argOnRequiredArg on Dog {
doesKnowCommand(dogCommand: SIT)
}
`)
}
示例5: TestValidate_KnownArgumentNames_MultipleArgsInReverseOrderAreKnown
func TestValidate_KnownArgumentNames_MultipleArgsInReverseOrderAreKnown(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownArgumentNamesRule, `
fragment multipleArgsReverseOrder on ComplicatedArgs {
multipleReqs(req2: 2, req1: 1)
}
`)
}
示例6: TestValidate_UniqueArgumentNames_SameArgumentOnTwoDirectives
func TestValidate_UniqueArgumentNames_SameArgumentOnTwoDirectives(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueArgumentNamesRule, `
{
field @directive1(arg: "value") @directive2(arg: "value")
}
`)
}
示例7: TestValidate_NoCircularFragmentSpreads_SpreadingTwiceIndirectlyIsNotCircular
func TestValidate_NoCircularFragmentSpreads_SpreadingTwiceIndirectlyIsNotCircular(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.NoFragmentCyclesRule, `
fragment fragA on Dog { ...fragB, ...fragC }
fragment fragB on Dog { ...fragC }
fragment fragC on Dog { name }
`)
}
示例8: TestValidate_FragmentsOnCompositeTypes_InterfaceIsValidFragmentType
func TestValidate_FragmentsOnCompositeTypes_InterfaceIsValidFragmentType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FragmentsOnCompositeTypesRule, `
fragment validFragment on Pet {
name
}
`)
}
示例9: TestValidate_FragmentsOnCompositeTypes_UnionIsValidFragmentType
func TestValidate_FragmentsOnCompositeTypes_UnionIsValidFragmentType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FragmentsOnCompositeTypesRule, `
fragment validFragment on CatOrDog {
__typename
}
`)
}
示例10: TestValidate_UniqueFragmentNames_NoFragments
func TestValidate_UniqueFragmentNames_NoFragments(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueFragmentNamesRule, `
{
field
}
`)
}
示例11: TestValidate_FragmentsOnCompositeTypes_ObjectIsValidFragmentType
func TestValidate_FragmentsOnCompositeTypes_ObjectIsValidFragmentType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FragmentsOnCompositeTypesRule, `
fragment validFragment on Dog {
barks
}
`)
}
示例12: TestValidate_KnownFragmentNames_KnownFragmentNamesAreValid
func TestValidate_KnownFragmentNames_KnownFragmentNamesAreValid(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.KnownFragmentNamesRule, `
{
human(id: 4) {
...HumanFields1
... on Human {
...HumanFields2
}
... {
name
}
}
}
fragment HumanFields1 on Human {
name
...HumanFields3
}
fragment HumanFields2 on Human {
name
}
fragment HumanFields3 on Human {
name
}
`)
}
示例13: TestValidate_FieldsOnCorrectType_IgnoresFieldsOnUnknownType
func TestValidate_FieldsOnCorrectType_IgnoresFieldsOnUnknownType(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment unknownSelection on UnknownType {
unknownField
}
`)
}
示例14: TestValidate_FieldsOnCorrectType_LyingAliasSelection
func TestValidate_FieldsOnCorrectType_LyingAliasSelection(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.FieldsOnCorrectTypeRule, `
fragment lyingAliasSelection on Dog {
name : nickname
}
`)
}
示例15: TestValidate_UniqueArgumentNames_NoArgumentsOnDirective
func TestValidate_UniqueArgumentNames_NoArgumentsOnDirective(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueArgumentNamesRule, `
{
field @directive
}
`)
}