2023-02-22 00:55:31 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-01 11:51:15 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 05:12:25 +00:00
|
|
|
RSpec.describe ActivityPub::MoveDistributionWorker do
|
2020-07-01 11:51:15 +00:00
|
|
|
subject { described_class.new }
|
|
|
|
|
2023-02-17 21:56:20 +00:00
|
|
|
let(:migration) { Fabricate(:account_migration) }
|
2023-07-20 16:23:48 +00:00
|
|
|
let(:follower) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example.com', domain: 'example.com') }
|
|
|
|
let(:blocker) { Fabricate(:account, protocol: :activitypub, inbox_url: 'http://example2.com', domain: 'example2.com') }
|
2020-07-01 11:51:15 +00:00
|
|
|
|
|
|
|
describe '#perform' do
|
|
|
|
before do
|
|
|
|
follower.follow!(migration.account)
|
|
|
|
blocker.block!(migration.account)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'delivers to followers and known blockers' do
|
2024-06-19 13:46:52 +00:00
|
|
|
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, expected_migration_deliveries) do
|
2023-11-07 09:46:28 +00:00
|
|
|
subject.perform(migration.id)
|
|
|
|
end
|
2020-07-01 11:51:15 +00:00
|
|
|
end
|
2024-06-19 13:46:52 +00:00
|
|
|
|
|
|
|
def expected_migration_deliveries
|
|
|
|
[
|
|
|
|
[match_json_values(type: 'Move'), migration.account.id, 'http://example.com'],
|
|
|
|
[match_json_values(type: 'Move'), migration.account.id, 'http://example2.com'],
|
|
|
|
]
|
|
|
|
end
|
2020-07-01 11:51:15 +00:00
|
|
|
end
|
|
|
|
end
|