Add coverage for ActivityPub likes/shares endpoints (#32305)

pull/32593/merge
Matt Jankowski 2024-10-23 02:41:07 -04:00 committed by GitHub
parent 0a4a73f9a6
commit 67403e7b01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 0 deletions

View 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

View 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