MCPcopy Create free account
hub / github.com/vektah/gqlparser / TestQueryDocMethods

Function TestQueryDocMethods

ast/document_test.go:13–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestQueryDocMethods(t *testing.T) {
14 doc, err := parser.ParseQuery(&Source{Input: `
15 query Bob { foo { ...Frag } }
16 fragment Frag on Foo {
17 bar
18 }
19 `})
20
21 require.NoError(t, err)
22 t.Run("GetOperation", func(t *testing.T) {
23 require.Equal(t, "Bob", doc.Operations.ForName("Bob").Name)
24 require.Nil(t, doc.Operations.ForName("Alice"))
25 })
26
27 t.Run("GetFragment", func(t *testing.T) {
28 require.Equal(t, "Frag", doc.Fragments.ForName("Frag").Name)
29 require.Nil(t, doc.Fragments.ForName("Alice"))
30 })
31}
32
33func TestNamedTypeCompatability(t *testing.T) {
34 assert.True(t, NamedType("A", nil).IsCompatible(NamedType("A", nil)))

Callers

nothing calls this directly

Calls 2

ParseQueryFunction · 0.92
ForNameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…