Add basic coverage for some worker jobs (#23943)

This commit is contained in:
Matt Jankowski 2023-03-04 10:56:09 -05:00 committed by GitHub
parent f9c2213ae5
commit 39e7525c96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 303 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'rails_helper'
describe Admin::AccountDeletionWorker do
let(:worker) { described_class.new }
describe 'perform' do
let(:account) { Fabricate(:account) }
let(:service) { instance_double(DeleteAccountService, call: true) }
it 'calls delete account service' do
allow(DeleteAccountService).to receive(:new).and_return(service)
worker.perform(account.id)
expect(service).to have_received(:call).with(account, { reserve_email: true, reserve_username: true })
end
end
end

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'rails_helper'
describe CacheBusterWorker do
let(:worker) { described_class.new }
describe 'perform' do
let(:path) { 'https://example.com' }
let(:service) { instance_double(CacheBuster, bust: true) }
it 'calls the cache buster' do
allow(CacheBuster).to receive(:new).and_return(service)
worker.perform(path)
expect(service).to have_received(:bust).with(path)
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe PollExpirationNotifyWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe PostProcessMediaWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe PushConversationWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe PushEncryptedMessageWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,16 @@
# frozen_string_literal: true
require 'rails_helper'
describe PushUpdateWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
account_id = nil
status_id = nil
expect { worker.perform(account_id, status_id) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe RedownloadAvatarWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe RedownloadHeaderWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
require 'rails_helper'
describe RemoveFeaturedTagWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
account_id = nil
featured_tag_id = nil
expect { worker.perform(account_id, featured_tag_id) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe ResolveAccountWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::IndexingScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::InstanceRefreshScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::IpCleanupScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::PgheroScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::ScheduledStatusesScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::SuspendedUserCleanupScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::Trends::RefreshScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::Trends::ReviewNotificationsScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Scheduler::VacuumScheduler do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe UnpublishAnnouncementWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error for missing record' do
expect { worker.perform(nil) }.to_not raise_error
end
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'rails_helper'
describe Webhooks::DeliveryWorker do
let(:worker) { described_class.new }
describe 'perform' do
it 'runs without error' do
expect { worker.perform(nil, nil) }.to_not raise_error
end
end
end