Sha256: 863a5e66a831aa4e87c2e1da9de0fc71de584662c89b46f1f1e3595e9cebb216
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' module GraphQL module Client class BaseTest < Minitest::Test def test_configure_yields_the_config client = Base.new(schema_fixture('schema.json')) client.configure do |c| assert_equal c, client.config end end def test_query_calls_adapter_request_with_query_builder_instance_and_creates_a_graph_object config = Config.new(url: 'http://example.com') query = Minitest::Mock.new query.expect(:to_query, 'query shopQuery { shop }') adapter = Minitest::Mock.new adapter.expect(:request, Response.new('{}'), [ 'query shopQuery { shop }', operation_name: 'shopQuery', variables: {} ]) mock = Minitest::Mock.new mock.expect(:call, nil, [data: nil, query: query]) GraphObject.stub(:new, mock) do client = Base.new(schema_fixture('schema.json'), config: config, adapter: adapter) client.query(query, operation_name: 'shopQuery') mock.verify query.verify end end def test_raw_query_calls_adapter_request_with_query_string config = Config.new(url: 'http://example.com') adapter = Minitest::Mock.new adapter.expect(:request, Response.new('{}'), ['query { shop }', operation_name: nil, variables: {}]) client = Base.new(schema_fixture('schema.json'), config: config, adapter: adapter) client.raw_query('query { shop }') adapter.verify end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graphql_client-0.3.3 | test/graphql_client/http_client_test.rb |