mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 07:05:23 +01:00
Add coverage for REST::AnnualReportEventSerializer
and two ActivityPub::*
serializers (#33355)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
22813dbc6e
commit
0ac43700d8
3 changed files with 60 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::AcceptFollowSerializer do
|
||||
subject { serialized_record_json(record, described_class, adapter: ActivityPub::Adapter) }
|
||||
|
||||
describe 'serializing an object' do
|
||||
let(:record) { Fabricate :follow_request }
|
||||
|
||||
it 'returns expected attributes' do
|
||||
expect(subject.deep_symbolize_keys)
|
||||
.to include(
|
||||
actor: eq(ActivityPub::TagManager.instance.uri_for(record.target_account)),
|
||||
id: match("#accepts/follows/#{record.id}"),
|
||||
object: include(type: 'Follow'),
|
||||
type: 'Accept'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::RejectFollowSerializer do
|
||||
subject { serialized_record_json(record, described_class, adapter: ActivityPub::Adapter) }
|
||||
|
||||
describe 'serializing an object' do
|
||||
let(:record) { Fabricate :follow_request }
|
||||
|
||||
it 'returns expected attributes' do
|
||||
expect(subject.deep_symbolize_keys)
|
||||
.to include(
|
||||
actor: eq(ActivityPub::TagManager.instance.uri_for(record.target_account)),
|
||||
id: match("#rejects/follows/#{record.id}"),
|
||||
object: include(type: 'Follow'),
|
||||
type: 'Reject'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
18
spec/serializers/rest/annual_report_event_serializer_spec.rb
Normal file
18
spec/serializers/rest/annual_report_event_serializer_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe REST::AnnualReportEventSerializer do
|
||||
subject { serialized_record_json(record, described_class) }
|
||||
|
||||
describe 'serializing an object' do
|
||||
let(:record) { Fabricate.build :generated_annual_report, year: 2024 }
|
||||
|
||||
it 'returns expected attributes' do
|
||||
expect(subject.deep_symbolize_keys)
|
||||
.to include(
|
||||
year: '2024'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue