Chatwoot/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js
Muhsin Keloth cf5f6d5a74
feat: enable Dialogflow integration all inboxes except email (#3285)
Fixes #2461

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2021-11-12 17:53:03 +05:30

69 lines
1.7 KiB
JavaScript

import { getters } from '../../inboxes';
import inboxList from './fixtures';
describe('#getters', () => {
it('getInboxes', () => {
const state = {
records: inboxList,
};
expect(getters.getInboxes(state)).toEqual(inboxList);
});
it('getWebsiteInboxes', () => {
const state = { records: inboxList };
expect(getters.getWebsiteInboxes(state).length).toEqual(3);
});
it('getTwilioInboxes', () => {
const state = { records: inboxList };
expect(getters.getTwilioInboxes(state).length).toEqual(1);
});
it('getTwilioSMSInboxes', () => {
const state = { records: inboxList };
expect(getters.getTwilioSMSInboxes(state).length).toEqual(1);
});
it('dialogFlowEnabledInboxes', () => {
const state = { records: inboxList };
expect(getters.dialogFlowEnabledInboxes(state).length).toEqual(5);
});
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,
enable_auto_assignment: true,
});
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: true,
isFetchingItem: false,
isCreating: false,
isUpdating: false,
isUpdatingAutoAssignment: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: true,
isFetchingItem: false,
isCreating: false,
isUpdating: false,
isUpdatingAutoAssignment: false,
isDeleting: false,
});
});
});