2019-12-28 16:26:42 +00:00
|
|
|
import { getters } from '../../inboxes';
|
|
|
|
import inboxList from './fixtures';
|
|
|
|
|
|
|
|
describe('#getters', () => {
|
|
|
|
it('getInboxes', () => {
|
|
|
|
const state = {
|
|
|
|
records: inboxList,
|
|
|
|
};
|
|
|
|
expect(getters.getInboxes(state)).toEqual(inboxList);
|
|
|
|
});
|
|
|
|
|
2021-06-06 11:29:05 +00:00
|
|
|
it('getWebsiteInboxes', () => {
|
|
|
|
const state = { records: inboxList };
|
|
|
|
expect(getters.getWebsiteInboxes(state).length).toEqual(3);
|
|
|
|
});
|
|
|
|
|
2021-08-11 14:59:33 +00:00
|
|
|
it('getTwilioInboxes', () => {
|
|
|
|
const state = { records: inboxList };
|
|
|
|
expect(getters.getTwilioInboxes(state).length).toEqual(1);
|
|
|
|
});
|
|
|
|
|
2022-02-03 23:22:13 +00:00
|
|
|
it('getSMSInboxes', () => {
|
2021-09-24 15:07:30 +00:00
|
|
|
const state = { records: inboxList };
|
2022-02-03 23:22:13 +00:00
|
|
|
expect(getters.getSMSInboxes(state).length).toEqual(2);
|
2021-09-24 15:07:30 +00:00
|
|
|
});
|
|
|
|
|
2021-11-12 12:23:03 +00:00
|
|
|
it('dialogFlowEnabledInboxes', () => {
|
|
|
|
const state = { records: inboxList };
|
2022-02-03 23:22:13 +00:00
|
|
|
expect(getters.dialogFlowEnabledInboxes(state).length).toEqual(6);
|
2021-11-12 12:23:03 +00:00
|
|
|
});
|
|
|
|
|
2019-12-28 16:26:42 +00:00
|
|
|
it('getInbox', () => {
|
|
|
|
const state = {
|
|
|
|
records: inboxList,
|
|
|
|
};
|
|
|
|
expect(getters.getInbox(state)(1)).toEqual({
|
|
|
|
id: 1,
|
|
|
|
channel_id: 1,
|
|
|
|
name: 'Test FacebookPage 1',
|
|
|
|
channel_type: 'Channel::FacebookPage',
|
|
|
|
avatar_url: 'random_image.png',
|
|
|
|
page_id: '12345',
|
|
|
|
widget_color: null,
|
|
|
|
website_token: null,
|
2020-02-19 09:10:03 +00:00
|
|
|
enable_auto_assignment: true,
|
2019-12-28 16:26:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('getUIFlags', () => {
|
|
|
|
const state = {
|
|
|
|
uiFlags: {
|
|
|
|
isFetching: true,
|
|
|
|
isFetchingItem: false,
|
|
|
|
isCreating: false,
|
|
|
|
isUpdating: false,
|
|
|
|
isDeleting: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(getters.getUIFlags(state)).toEqual({
|
|
|
|
isFetching: true,
|
|
|
|
isFetchingItem: false,
|
|
|
|
isCreating: false,
|
|
|
|
isUpdating: false,
|
|
|
|
isDeleting: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|