Chore: Events Cleanup (#739)

* Chore: Events Cleanup

- fix failing tests
- add additional webhook events
- clean up event logic

* Fix conversation status update in action cable

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-04-18 20:25:58 +05:30
committed by GitHub
parent ecccb103a0
commit c0ce70e87b
14 changed files with 150 additions and 69 deletions

View File

@@ -20,9 +20,12 @@ describe ActionCableListener do
let(:event_name) { :'message.created' }
it 'sends message to account admins, inbox agents and the contact' do
expect(ActionCableBroadcastJob).to receive(:perform_later).with([admin.pubsub_token], 'message.created', message.push_event_data)
expect(ActionCableBroadcastJob).to receive(:perform_later).with([agent.pubsub_token], 'message.created', message.push_event_data)
expect(ActionCableBroadcastJob).to receive(:perform_later).with([conversation.contact.pubsub_token], 'message.created', message.push_event_data)
expect(ActionCableBroadcastJob).to receive(:perform_later).with(
[agent.pubsub_token, admin.pubsub_token], 'message.created', message.push_event_data
)
expect(ActionCableBroadcastJob).to receive(:perform_later).with(
[conversation.contact.pubsub_token], 'message.created', message.push_event_data
)
listener.message_created(event)
end
end