Feature: Alert widget user when message is received from agent (#571)
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { playNotificationAudio } from 'shared/helpers/AudioNotificationHelper';
|
||||
import { actions } from '../../conversation';
|
||||
import getUuid from '../../../../helpers/uuid';
|
||||
|
||||
jest.mock('../../../../helpers/uuid');
|
||||
jest.mock('shared/helpers/AudioNotificationHelper', () => ({
|
||||
playNotificationAudio: jest.fn(),
|
||||
}));
|
||||
|
||||
const commit = jest.fn();
|
||||
|
||||
@@ -11,6 +15,15 @@ describe('#actions', () => {
|
||||
actions.addMessage({ commit }, { id: 1 });
|
||||
expect(commit).toBeCalledWith('pushMessageToConversation', { id: 1 });
|
||||
});
|
||||
|
||||
it('plays audio when agent sends a message', () => {
|
||||
actions.addMessage({ commit }, { id: 1, message_type: 1 });
|
||||
expect(playNotificationAudio).toBeCalled();
|
||||
expect(commit).toBeCalledWith('pushMessageToConversation', {
|
||||
id: 1,
|
||||
message_type: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#sendMessage', () => {
|
||||
|
||||
Reference in New Issue
Block a user