Add basic coverage for CreateFeaturedTagService class (#29321)

This commit is contained in:
Matt Jankowski 2024-02-21 11:58:19 -05:00 committed by GitHub
parent 5f19e7e799
commit b73932461f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,31 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe CreateFeaturedTagService do
describe '#call' do
let(:tag) { 'test' }
context 'with a local account' do
let(:account) { Fabricate(:account, domain: nil) }
it 'creates a new featured tag and distributes' do
expect { subject.call(account, tag) }
.to change(FeaturedTag, :count).by(1)
expect(ActivityPub::AccountRawDistributionWorker)
.to have_enqueued_sidekiq_job(anything, account.id)
end
end
context 'with a remote account' do
let(:account) { Fabricate(:account, domain: 'host.example') }
it 'creates a new featured tag and does not distributes' do
expect { subject.call(account, tag) }
.to change(FeaturedTag, :count).by(1)
expect(ActivityPub::AccountRawDistributionWorker)
.to_not have_enqueued_sidekiq_job
end
end
end
end