diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-03 04:55:39 -0500 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2020-08-04 19:43:19 +0200 |
commit | 13501f73935687a52ca67710f5446c350e9cc0a2 (patch) | |
tree | ebea7d69b5b9f80d8101611a0dd26e1e56e1dcf1 /spec | |
parent | 3d5b3e357c26aeee86da8f69a86130d52f325729 (diff) |
Add tests for direct message assertions
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/activitypub/activity/create_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 51e0b8caf..6e9f6cfa5 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -146,6 +146,31 @@ RSpec.describe ActivityPub::Activity::Create do end end + context 'limited when direct message assertion is false' do + let(:recipient) { Fabricate(:account) } + + let(:object_json) do + { + id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, + type: 'Note', + content: 'Lorem ipsum', + directMessage: false, + to: ActivityPub::TagManager.instance.uri_for(recipient), + tag: { + type: 'Mention', + href: ActivityPub::TagManager.instance.uri_for(recipient), + }, + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.visibility).to eq 'limited' + end + end + context 'direct' do let(:recipient) { Fabricate(:account) } @@ -170,6 +195,27 @@ RSpec.describe ActivityPub::Activity::Create do end end + context 'direct when direct message assertion is true' do + let(:recipient) { Fabricate(:account) } + + let(:object_json) do + { + id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, + type: 'Note', + content: 'Lorem ipsum', + to: ActivityPub::TagManager.instance.uri_for(recipient), + directMessage: true, + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.visibility).to eq 'direct' + end + end + context 'as a reply' do let(:original_status) { Fabricate(:status) } |