feat: Add notification.updated event (#8871)

This commit is contained in:
Muhsin Keloth
2024-02-07 18:15:51 +05:30
committed by GitHub
parent 7776b74126
commit 1b21e0d429
10 changed files with 66 additions and 10 deletions

View File

@@ -152,6 +152,27 @@ describe ActionCableListener do
end
end
describe '#notification_updated' do
let(:event_name) { :'notification.updated' }
let!(:notification) { create(:notification, account: account, user: agent) }
let!(:event) { Events::Base.new(event_name, Time.zone.now, notification: notification) }
it 'sends notification to account admins, inbox agents' do
expect(ActionCableBroadcastJob).to receive(:perform_later).with(
[agent.pubsub_token],
'notification.updated',
{
account_id: notification.account_id,
notification: notification.push_event_data,
unread_count: 1,
count: 1
}
)
listener.notification_updated(event)
end
end
describe '#conversation_updated' do
let(:event_name) { :'conversation.updated' }
let!(:event) { Events::Base.new(event_name, Time.zone.now, conversation: conversation, user: agent, is_private: false) }