Sha256: 6ffc6f5215d29f1c33d52fbaad215f1ef79457bfde503109fc69ca9b0b07dce9
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require 'test_helper' module GraphQL module Client class ResponseConnectionTest < Minitest::Test def test_each_yields_the_edges_node connection = ResponseConnection.new( 'edges' => [ { 'cursor' => 'first-cursor', 'node' => { 'id' => 1, 'title' => 'Product 1' } }, { 'cursor' => 'last-cursor', 'node' => { 'id' => 2, 'title' => 'Product 2' } } ] ) assert_equal connection.edges.map(&:node), connection.to_a end def test_delegates_has_next_page_to_page_info connection = ResponseConnection.new( 'pageInfo' => { 'hasNextPage' => true } ) assert_equal true, connection.has_next_page? end def test_delegates_has_previous_page_to_page_info connection = ResponseConnection.new( 'pageInfo' => { 'hasPreviousPage' => false } ) assert_equal false, connection.has_previous_page? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql_client-0.4.1 | test/graphql_client/response_connection_test.rb |
graphql_client-0.3.3 | test/graphql_client/response_connection_test.rb |