Skip to content

Commit 65435b7

Browse files
committed
more tests.
1 parent e6e6fc8 commit 65435b7

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

test/graphql/stitching/integration/authorizations_test.rb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_errors_of_non_null_child_fields_bubble
6868

6969
assert_equal expected, result.to_h
7070
end
71-
71+
7272
def test_responds_with_error_for_unauthorized_parent_field
7373
query = %|{
7474
orderA(id: "1") {
@@ -92,4 +92,31 @@ def test_responds_with_error_for_unauthorized_parent_field
9292

9393
assert_equal expected, result.to_h
9494
end
95+
96+
def test_expected_results_with_proper_permissions
97+
query = %|{
98+
orderA(id: "1") {
99+
customer2 {
100+
email
101+
phone
102+
slack
103+
}
104+
}
105+
}|
106+
107+
result = plan_and_execute(@supergraph, query, claims: ["orders", "customers"])
108+
expected = {
109+
"data" => {
110+
"orderA" => {
111+
"customer2" => {
112+
"email" => "pete.cat@gmail.com",
113+
"phone" => "123.456.7890",
114+
"slack" => nil,
115+
},
116+
},
117+
},
118+
}
119+
120+
assert_equal expected, result.to_h
121+
end
95122
end

test/schemas/authorizations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Authorizations
99
].freeze
1010

1111
ORDERS = [
12-
{ id: "1", shipping_address: "123 Main", product_id: "1", customer: { email: "pete.cat@gmail.com" } },
12+
{ id: "1", shipping_address: "123 Main", product_id: "1", customer: { email: "pete.cat@gmail.com", phone: "123.456.7890" } },
1313
{ id: "2", shipping_address: "456 Market", product_id: "2", customer: { email: "grumpytoad@gmail.com" } },
1414
].freeze
1515

0 commit comments

Comments
 (0)