3fc646f330
* add campaign store(getter, actions and mutations) * add campaign store module * add get campaigns api * add fetch campaign action widget load * add specs * code cleanup * trigger campaig api fixes * integrate campaign trigger action * code cleanup * revert changes * trigger api fixes * review fixes * code beautification * chore: Fix multiple campaigns being send because of race condition * chore: rubocop * chore: Fix specs * disable campaigns Co-authored-by: Nithin David Thomas <webofnithin@gmail.com> Co-authored-by: Sojan <sojan@pepalo.com>
96 lines
2.5 KiB
JavaScript
96 lines
2.5 KiB
JavaScript
import { getters } from '../../campaign';
|
|
import { campaigns } from './data';
|
|
|
|
describe('#getters', () => {
|
|
it('fetchCampaigns', () => {
|
|
const state = {
|
|
records: campaigns,
|
|
};
|
|
expect(getters.fetchCampaigns(state)).toEqual([
|
|
{
|
|
id: 1,
|
|
title: 'Welcome',
|
|
description: null,
|
|
account_id: 1,
|
|
inbox: {
|
|
id: 37,
|
|
channel_id: 1,
|
|
name: 'Chatwoot',
|
|
channel_type: 'Channel::WebWidget',
|
|
},
|
|
sender: {
|
|
account_id: 1,
|
|
availability_status: 'offline',
|
|
confirmed: true,
|
|
email: 'sojan@chatwoot.com',
|
|
available_name: 'Sojan',
|
|
id: 10,
|
|
name: 'Sojan',
|
|
},
|
|
message: 'Hey, What brings you today',
|
|
enabled: true,
|
|
trigger_rules: {
|
|
url: 'https://github.com',
|
|
time_on_page: 10,
|
|
},
|
|
created_at: '2021-05-03T04:53:36.354Z',
|
|
updated_at: '2021-05-03T04:53:36.354Z',
|
|
},
|
|
{
|
|
id: 11,
|
|
title: 'Onboarding Campaign',
|
|
description: null,
|
|
account_id: 1,
|
|
inbox: {
|
|
id: 37,
|
|
channel_id: 1,
|
|
name: 'GitX',
|
|
channel_type: 'Channel::WebWidget',
|
|
},
|
|
sender: {
|
|
account_id: 1,
|
|
availability_status: 'offline',
|
|
confirmed: true,
|
|
email: 'sojan@chatwoot.com',
|
|
available_name: 'Sojan',
|
|
id: 10,
|
|
},
|
|
message: 'Begin your onboarding campaign with a welcome message',
|
|
enabled: true,
|
|
trigger_rules: {
|
|
url: 'https://chatwoot.com',
|
|
time_on_page: '20',
|
|
},
|
|
created_at: '2021-05-03T08:15:35.828Z',
|
|
updated_at: '2021-05-03T08:15:35.828Z',
|
|
},
|
|
{
|
|
id: 12,
|
|
title: 'Thanks',
|
|
description: null,
|
|
account_id: 1,
|
|
inbox: {
|
|
id: 37,
|
|
channel_id: 1,
|
|
name: 'Chatwoot',
|
|
channel_type: 'Channel::WebWidget',
|
|
},
|
|
sender: {
|
|
account_id: 1,
|
|
availability_status: 'offline',
|
|
confirmed: true,
|
|
email: 'nithin@chatwoot.com',
|
|
available_name: 'Nithin',
|
|
},
|
|
message: 'Thanks for coming to the show. How may I help you?',
|
|
enabled: false,
|
|
trigger_rules: {
|
|
url: 'https://noshow.com',
|
|
time_on_page: 10,
|
|
},
|
|
created_at: '2021-05-03T10:22:51.025Z',
|
|
updated_at: '2021-05-03T10:22:51.025Z',
|
|
},
|
|
]);
|
|
});
|
|
});
|