@@ -108,12 +108,11 @@ def get_page_info(result, key = "bases")
108
108
result = star_wars_query ( query_string , { "after" => first_cursor , "first" => 2 } )
109
109
assert_equal ( [ "Y-Wing" , "A-Wing" ] , get_names ( result ) )
110
110
111
- # After the last result, find the next 2:
112
- second_cursor = get_last_cursor ( result )
111
+ third_cursor = get_last_cursor ( result )
113
112
114
- # There is only 2 results between the cursors
115
- result = star_wars_query ( query_string , { "after" => first_cursor , "before" => second_cursor , "first" => 5 } )
116
- assert_equal ( [ "Y-Wing" , "A-Wing" ] , get_names ( result ) )
113
+ # There is only 1 result between the cursors
114
+ result = star_wars_query ( query_string , { "after" => first_cursor , "before" => third_cursor , "first" => 5 } )
115
+ assert_equal ( [ "Y-Wing" ] , get_names ( result ) )
117
116
end
118
117
119
118
it 'handles cursors beyond the bounds of the array' do
@@ -175,7 +174,7 @@ def get_names(result)
175
174
# Max page size is applied _without_ `first`, also
176
175
result = star_wars_query ( query_string )
177
176
assert_equal ( [ "Yavin" , "Echo Base" ] , get_names ( result ) )
178
- assert_equal ( true , get_page_info ( result ) [ "hasNextPage" ] , "hasNextPage is true when first is not specified" )
177
+ assert_equal ( false , get_page_info ( result ) [ "hasNextPage" ] , "hasNextPage is false when first is not specified" )
179
178
end
180
179
181
180
it "applies to queries by `last`" do
@@ -235,7 +234,7 @@ def get_page_info(result)
235
234
# Max page size is applied _without_ `first`, also
236
235
result = star_wars_query ( query_string )
237
236
assert_equal ( [ "Yavin" , "Echo Base" , "Secret Hideout" ] , get_names ( result ) )
238
- assert_equal ( true , get_page_info ( result ) [ "hasNextPage" ] , "hasNextPage is true when first is not specified" )
237
+ assert_equal ( false , get_page_info ( result ) [ "hasNextPage" ] , "hasNextPage is false when first is not specified" )
239
238
end
240
239
241
240
it "applies to queries by `last`" do
0 commit comments