spec/graphql/relay/relation_connection_spec.rb in graphql-1.7.13 vs spec/graphql/relay/relation_connection_spec.rb in graphql-1.7.14
- old
+ new
@@ -115,10 +115,17 @@
star_wars_query(query_string, "first" => 1, "after" => last_cursor)
}
assert_equal true, get_page_info(result)["hasNextPage"]
assert_equal true, get_page_info(result)["hasPreviousPage"]
+ last_cursor = get_last_cursor(result)
+ result = with_bidirectional_pagination {
+ star_wars_query(query_string, "last" => 1, "before" => last_cursor)
+ }
+ assert_equal true, get_page_info(result)["hasNextPage"]
+ assert_equal false, get_page_info(result)["hasPreviousPage"]
+
result = star_wars_query(query_string, "first" => 100)
last_cursor = get_last_cursor(result)
result = star_wars_query(query_string, "last" => 1, "before" => last_cursor)
assert_equal false, get_page_info(result)["hasNextPage"]
@@ -127,10 +134,9 @@
result = with_bidirectional_pagination {
star_wars_query(query_string, "last" => 1, "before" => last_cursor)
}
assert_equal true, get_page_info(result)["hasNextPage"]
assert_equal true, get_page_info(result)["hasPreviousPage"]
-
end
it 'slices the result' do
result = star_wars_query(query_string, "first" => 2)
assert_equal(["Death Star", "Shield Generator"], get_names(result))