mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-27 02:24:03 -05:00
Add coverage for ActivityPub likes/shares endpoints (#32305)
This commit is contained in:
parent
0a4a73f9a6
commit
67403e7b01
25
spec/requests/activitypub/likes_spec.rb
Normal file
25
spec/requests/activitypub/likes_spec.rb
Normal file
@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'ActivityPub Likes' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:status) { Fabricate :status, account: account }
|
||||
|
||||
before { Fabricate :favourite, status: status }
|
||||
|
||||
describe 'GET /accounts/:account_username/statuses/:status_id/likes' do
|
||||
it 'returns http success and activity json types and correct items count' do
|
||||
get account_status_likes_path(account, status)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.media_type)
|
||||
.to eq 'application/activity+json'
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to include(type: 'Collection')
|
||||
.and include(totalItems: 1)
|
||||
end
|
||||
end
|
||||
end
|
25
spec/requests/activitypub/shares_spec.rb
Normal file
25
spec/requests/activitypub/shares_spec.rb
Normal file
@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'ActivityPub Shares' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:status) { Fabricate :status, account: account }
|
||||
|
||||
before { Fabricate :status, reblog: status }
|
||||
|
||||
describe 'GET /accounts/:account_username/statuses/:status_id/shares' do
|
||||
it 'returns http success and activity json types and correct items count' do
|
||||
get account_status_shares_path(account, status)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.media_type)
|
||||
.to eq 'application/activity+json'
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to include(type: 'Collection')
|
||||
.and include(totalItems: 1)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user