fixes
This commit is contained in:
@@ -23,9 +23,10 @@ RSpec.describe Notification do
|
||||
|
||||
context 'when push_title is called' do
|
||||
it 'returns appropriate title suited for the notification type conversation_creation' do
|
||||
notification = create(:notification, notification_type: 'conversation_creation')
|
||||
expect(notification.push_message_title).to eq "[New conversation] - ##{notification.primary_actor.display_id} has\
|
||||
been created in #{notification.primary_actor.inbox.name}"
|
||||
conversation = create(:conversation)
|
||||
message = create(:message, sender: create(:user), content: Faker::Lorem.paragraphs(number: 2), conversation: conversation)
|
||||
notification = create(:notification, notification_type: 'conversation_creation', primary_actor: conversation)
|
||||
expect(notification.push_message_title).to eq "#{message.sender.name}: #{message.content}"
|
||||
end
|
||||
|
||||
it 'returns appropriate title suited for the notification type conversation_assignment' do
|
||||
@@ -39,8 +40,7 @@ RSpec.describe Notification do
|
||||
notification = create(:notification, notification_type: 'assigned_conversation_new_message', primary_actor: message.conversation,
|
||||
secondary_actor: message)
|
||||
|
||||
expect(notification.push_message_title).to eq "[New message] - ##{notification.conversation.display_id} \
|
||||
#{message.content.truncate_words(10)}"
|
||||
expect(notification.push_message_title).to eq "#{message.sender.name}: #{message.content.truncate_words(10)}"
|
||||
end
|
||||
|
||||
it 'returns appropriate title suited for the notification type assigned_conversation_new_message when attachment message' do
|
||||
@@ -100,8 +100,7 @@ Hey @John, @Alisha Peter can you check this ticket?"
|
||||
content: 'Hey [@John](mention://user/1/john), [@Alisha Peter](mention://user/2/alisha) can you check this ticket?'
|
||||
)
|
||||
notification = create(:notification, notification_type: 'conversation_mention', primary_actor: message.conversation, secondary_actor: message)
|
||||
|
||||
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John, @Alisha Peter can you check this ticket?"
|
||||
expect(notification.push_message_title).to eq "#{message.sender.name}: Hey @John, @Alisha Peter can you check this ticket?"
|
||||
end
|
||||
|
||||
it 'returns appropriate title suited for the notification type conversation_mention if username contains white space' do
|
||||
@@ -111,7 +110,7 @@ Hey @John, @Alisha Peter can you check this ticket?"
|
||||
content: 'Hey [@John Peter](mention://user/1/john%20K) please check this?'
|
||||
)
|
||||
notification = create(:notification, notification_type: 'conversation_mention', primary_actor: message.conversation, secondary_actor: message)
|
||||
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John Peter please check this?"
|
||||
expect(notification.push_message_title).to eq "#{message.sender.name}: Hey @John Peter please check this?"
|
||||
end
|
||||
|
||||
it 'calls remove duplicate notification job' do
|
||||
|
||||
Reference in New Issue
Block a user