Skip to content

Commit

Permalink
tests: for the love of god all the tests happen so fast the post IDs …
Browse files Browse the repository at this point in the history
…dont necessarily increment
  • Loading branch information
sneakers-the-rat committed Jan 25, 2024
1 parent aab3d4c commit d57df5b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spec/models/public_feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,20 @@
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|
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 + 1000, status.id).map(&:id)
second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).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 + 1000, status.id).map(&:id)
second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).map(&:id)

expect(subject).to include(second_boost.id)
expect(second_page).to_not include(boost.id)
Expand Down

0 comments on commit d57df5b

Please sign in to comment.