Skip to content

Commit 3cffca8

Browse files
committed
Update rails tests
1 parent 0cbf0a2 commit 3cffca8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

spec/integration/rails/graphql/relay/array_connection_spec.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,11 @@ def get_page_info(result, key = "bases")
108108
result = star_wars_query(query_string, { "after" => first_cursor, "first" => 2 })
109109
assert_equal(["Y-Wing", "A-Wing"], get_names(result))
110110

111-
# After the last result, find the next 2:
112-
second_cursor = get_last_cursor(result)
111+
third_cursor = get_last_cursor(result)
113112

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))
117116
end
118117

119118
it 'handles cursors beyond the bounds of the array' do
@@ -175,7 +174,7 @@ def get_names(result)
175174
# Max page size is applied _without_ `first`, also
176175
result = star_wars_query(query_string)
177176
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")
179178
end
180179

181180
it "applies to queries by `last`" do
@@ -235,7 +234,7 @@ def get_page_info(result)
235234
# Max page size is applied _without_ `first`, also
236235
result = star_wars_query(query_string)
237236
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")
239238
end
240239

241240
it "applies to queries by `last`" do

spec/integration/rails/graphql/relay/relation_connection_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def get_last_cursor(result)
287287
# Max page size is applied _without_ `first`, also
288288
result = star_wars_query(query_string)
289289
assert_equal(2, result["data"]["empire"]["bases"]["edges"].size)
290-
assert_equal(true, result["data"]["empire"]["bases"]["pageInfo"]["hasNextPage"], "hasNextPage is true when first is not specified")
290+
assert_equal(false, result["data"]["empire"]["bases"]["pageInfo"]["hasNextPage"], "hasNextPage is false when first is not specified")
291291
end
292292

293293
it "applies to queries by `last`" do
@@ -346,7 +346,7 @@ def get_last_cursor(result)
346346
# Max page size is applied _without_ `first`, also
347347
result = star_wars_query(query_string)
348348
assert_equal(3, result["data"]["empire"]["bases"]["edges"].size)
349-
assert_equal(true, result["data"]["empire"]["bases"]["pageInfo"]["hasNextPage"], "hasNextPage is true when first is not specified")
349+
assert_equal(false, result["data"]["empire"]["bases"]["pageInfo"]["hasNextPage"], "hasNextPage is false when first is not specified")
350350
end
351351

352352
it "applies to queries by `last`" do

0 commit comments

Comments
 (0)