From 58b209926c12c2b2adb7ae0c985bb8b1e8ef2ee4 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 24 Jan 2024 20:58:57 -0800 Subject: [PATCH] tests: truly sorry for the commit spam, tests don't run locally --- spec/models/public_feed_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/models/public_feed_spec.rb b/spec/models/public_feed_spec.rb index 4d713a5353a77f..cf516b3ec39999 100644 --- a/spec/models/public_feed_spec.rb +++ b/spec/models/public_feed_spec.rb @@ -64,23 +64,26 @@ booster = Fabricate(:account, domain: nil) status = Fabricate(:status, account: poster) + # sleep for 2ms to make sure the other posts come in a greater snowflake ID + sleep(0.002) + boost = Fabricate(:status, reblog_of_id: status.id, account: poster) expect(subject).to include(boost.id) # sleep for 2ms to make sure the other posts come in a greater snowflake ID sleep(0.002) - (1..40).each do |_i| + (1..20).each do |_i| Fabricate(:status, account: poster) end # before a second boost, the second page should still include the original boost - second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).map(&:id) + second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id - 1).map(&:id) expect(second_page).to include(boost.id) # after a second boost, the second page should no longer include the original boost second_boost = Fabricate(:status, reblog_of_id: status.id, account: booster) - second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).map(&:id) + second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id - 1).map(&:id) expect(subject).to include(second_boost.id) expect(second_page).to_not include(boost.id)