summaryrefslogtreecommitdiff
path: root/test/integration/server_test.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-12-21 17:23:09 -0700
committermo khan <mo.khan@gmail.com>2020-12-21 17:23:09 -0700
commitbcc2ad30081dbb78983c1545c188cefa20486a04 (patch)
tree309f243ed5daa85ad415c2df3a70359ca74c9261 /test/integration/server_test.rb
parent143465ae64450be1a171b4f80111d53bb268fbc5 (diff)
test: play with introspection system
Diffstat (limited to 'test/integration/server_test.rb')
-rw-r--r--test/integration/server_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/integration/server_test.rb b/test/integration/server_test.rb
index 5bc7089..ae2da22 100644
--- a/test/integration/server_test.rb
+++ b/test/integration/server_test.rb
@@ -28,4 +28,36 @@ class ServerTest < Minitest::Test
json = JSON.parse(last_response.body)
assert_equal 'mo', json['data']['me']
end
+
+ def test_get_schema
+ header 'Content-Type', 'application/graphql'
+ post '/', '{ __schema { types { name } } }'
+
+ assert last_response.ok?
+ json = JSON.parse(last_response.body)
+
+ [
+ 'Boolean',
+ 'Cake',
+ 'Query',
+ 'String',
+ '__Directive',
+ '__DirectiveLocation',
+ '__EnumValue',
+ '__InputValue',
+ '__Type',
+ '__TypeKind',
+ ].each do |type|
+ assert json['data']['__schema']['types'].include?('name' => type)
+ end
+ end
+
+ def test_get_query_type
+ header 'Content-Type', 'application/graphql'
+ post '/', '{ __schema { queryType { name } } }'
+
+ assert last_response.ok?
+ json = JSON.parse(last_response.body)
+ assert 'Query', json['data']['__schema']['queryType']['name']
+ end
end