Fix some flaky tests that randomly failed because of item ordering (#17509)
This commit is contained in:
parent
2af03164cb
commit
472bc89611
5 changed files with 20 additions and 20 deletions
|
@ -47,7 +47,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
|
||||||
|
|
||||||
it 'returns orderedItems with followers from example.com' do
|
it 'returns orderedItems with followers from example.com' do
|
||||||
expect(body[:orderedItems]).to be_an Array
|
expect(body[:orderedItems]).to be_an Array
|
||||||
expect(body[:orderedItems].sort).to eq [follower_4.uri, follower_1.uri, follower_2.uri]
|
expect(body[:orderedItems]).to match_array([follower_4.uri, follower_1.uri, follower_2.uri])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns private Cache-Control header' do
|
it 'returns private Cache-Control header' do
|
||||||
|
|
|
@ -79,7 +79,7 @@ describe Api::V1::Accounts::StatusesController do
|
||||||
it 'lists both the public and the private statuses' do
|
it 'lists both the public and the private statuses' do
|
||||||
get :index, params: { account_id: account.id, pinned: true }
|
get :index, params: { account_id: account.id, pinned: true }
|
||||||
json = body_as_json
|
json = body_as_json
|
||||||
expect(json.map { |item| item[:id].to_i }.sort).to eq [status.id, private_status.id].sort
|
expect(json.map { |item| item[:id].to_i }).to match_array([status.id, private_status.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -495,7 +495,7 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns only normal statuses for deletion' do
|
it 'returns only normal statuses for deletion' do
|
||||||
expect(subject.pluck(:id).sort).to eq [very_old_status.id, faved4.id, faved5.id, reblogged4.id, reblogged5.id].sort
|
expect(subject.pluck(:id)).to match_array([very_old_status.id, faved4.id, faved5.id, reblogged4.id, reblogged5.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -279,17 +279,17 @@ RSpec.describe Status, type: :model do
|
||||||
|
|
||||||
context 'when given one tag' do
|
context 'when given one tag' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with([tag1.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status5.id]
|
expect(Status.tagged_with([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status5.id])
|
||||||
expect(Status.tagged_with([tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status2.id, status5.id]
|
expect(Status.tagged_with([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status5.id])
|
||||||
expect(Status.tagged_with([tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status3.id, status5.id]
|
expect(Status.tagged_with([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id, status5.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when given multiple tags' do
|
context 'when given multiple tags' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status2.id, status5.id]
|
expect(Status.tagged_with([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status2.id, status5.id])
|
||||||
expect(Status.tagged_with([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status3.id, status5.id]
|
expect(Status.tagged_with([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status3.id, status5.id])
|
||||||
expect(Status.tagged_with([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status2.id, status3.id, status5.id]
|
expect(Status.tagged_with([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status3.id, status5.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -306,15 +306,15 @@ RSpec.describe Status, type: :model do
|
||||||
|
|
||||||
context 'when given one tag' do
|
context 'when given one tag' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with_all([tag1.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status5.id]
|
expect(Status.tagged_with_all([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status5.id])
|
||||||
expect(Status.tagged_with_all([tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status2.id, status5.id]
|
expect(Status.tagged_with_all([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status5.id])
|
||||||
expect(Status.tagged_with_all([tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status3.id]
|
expect(Status.tagged_with_all([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when given multiple tags' do
|
context 'when given multiple tags' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with_all([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status5.id]
|
expect(Status.tagged_with_all([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status5.id])
|
||||||
expect(Status.tagged_with_all([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
|
expect(Status.tagged_with_all([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
|
||||||
expect(Status.tagged_with_all([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
|
expect(Status.tagged_with_all([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq []
|
||||||
end
|
end
|
||||||
|
@ -333,17 +333,17 @@ RSpec.describe Status, type: :model do
|
||||||
|
|
||||||
context 'when given one tag' do
|
context 'when given one tag' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with_none([tag1.id]).reorder(:id).pluck(:id).uniq).to eq [status2.id, status3.id, status4.id]
|
expect(Status.tagged_with_none([tag1.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status3.id, status4.id])
|
||||||
expect(Status.tagged_with_none([tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status3.id, status4.id]
|
expect(Status.tagged_with_none([tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status3.id, status4.id])
|
||||||
expect(Status.tagged_with_none([tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status2.id, status4.id]
|
expect(Status.tagged_with_none([tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status2.id, status4.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when given multiple tags' do
|
context 'when given multiple tags' do
|
||||||
it 'returns the expected statuses' do
|
it 'returns the expected statuses' do
|
||||||
expect(Status.tagged_with_none([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to eq [status3.id, status4.id]
|
expect(Status.tagged_with_none([tag1.id, tag2.id]).reorder(:id).pluck(:id).uniq).to match_array([status3.id, status4.id])
|
||||||
expect(Status.tagged_with_none([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status2.id, status4.id]
|
expect(Status.tagged_with_none([tag1.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status2.id, status4.id])
|
||||||
expect(Status.tagged_with_none([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to eq [status1.id, status4.id]
|
expect(Status.tagged_with_none([tag2.id, tag3.id]).reorder(:id).pluck(:id).uniq).to match_array([status1.id, status4.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,7 +114,7 @@ RSpec.describe UpdateStatusService, type: :service do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'keeps old mentions as silent mentions' do
|
it 'keeps old mentions as silent mentions' do
|
||||||
expect(status.mentions.pluck(:account_id)).to eq [alice.id, bob.id]
|
expect(status.mentions.pluck(:account_id)).to match_array([alice.id, bob.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue