Sha256: 54fc864610990b5177c2df46a1165fd4fce069c94d5c29945084ea4b962446ba
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require 'test_helper' module GraphQL module Client module Query class FragmentTest < Minitest::Test def setup @schema = GraphQLSchema.new(schema_fixture('schema.json')) @document = Document.new(@schema) end def test_resolver_type_is_the_type shop = @schema.type('Shop') fragment = Fragment.new('shopFields', shop, document: @document) assert_equal shop, fragment.resolver_type end def test_to_definition shop = @schema.type('Shop') fragment = Fragment.new('shopFields', shop, document: @document) fragment.add_field('name') definition_string = <<~QUERY fragment shopFields on Shop { name } QUERY assert_equal definition_string, fragment.to_definition end def test_to_query_is_the_fragment_spread shop = @schema.type('Shop') fragment = Fragment.new('shopFields', shop, document: @document) do |f| f.add_field('name') end assert_equal '...shopFields', fragment.to_query end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql_client-0.4.1 | test/graphql_client/query/fragment_test.rb |
graphql_client-0.3.3 | test/graphql_client/query/fragment_test.rb |