Skip to content

Commit 99ddb80

Browse files
jhawthornDinah Shi
and
Dinah Shi
committed
Add failing test for field named errors
Co-authored-by: Dinah Shi <[email protected]>
1 parent 0fe91e2 commit 99ddb80

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/test_query_result.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,27 @@ def test_parse_nested_inline_fragments_on_same_node
855855
assert_equal "secret", user.password
856856
end
857857

858+
def test_parse_fragment_with_field_named_error
859+
Temp.const_set :UserFragment, @client.parse(<<-'GRAPHQL')
860+
fragment on User {
861+
errors: profileName
862+
}
863+
GRAPHQL
864+
865+
Temp.const_set :Query, @client.parse(<<-'GRAPHQL')
866+
{
867+
node(id: "1") {
868+
...TestQueryResult::Temp::UserFragment
869+
}
870+
}
871+
GRAPHQL
872+
873+
response = @client.query(Temp::Query)
874+
user = Temp::UserFragment.new(response.data.node)
875+
876+
assert_equal "Josh", user.errors
877+
end
878+
858879
def test_parse_fragment_query_result_aliases
859880
Temp.const_set :UserFragment, @client.parse(<<-'GRAPHQL')
860881
fragment on User {

0 commit comments

Comments
 (0)