mirror of
https://github.com/lingble/chatwoot.git
synced 2025-12-16 18:57:05 +00:00
We have added warnings for existing Instagram messenger inboxes via https://github.com/chatwoot/chatwoot/pull/11303. There is an issue with finding the correct Instagram/messenger inbox. This PR will fixes that issue.
97 lines
2.5 KiB
JavaScript
97 lines
2.5 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('getSMSInboxes', () => {
|
|
const state = { records: inboxList };
|
|
expect(getters.getSMSInboxes(state).length).toEqual(2);
|
|
});
|
|
|
|
it('dialogFlowEnabledInboxes', () => {
|
|
const state = { records: inboxList };
|
|
expect(getters.dialogFlowEnabledInboxes(state).length).toEqual(7);
|
|
});
|
|
|
|
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,
|
|
instagram_id: 123456789,
|
|
});
|
|
});
|
|
|
|
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,
|
|
});
|
|
});
|
|
|
|
it('getFacebookInboxByInstagramId', () => {
|
|
const state = { records: inboxList };
|
|
expect(getters.getFacebookInboxByInstagramId(state)(123456789)).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,
|
|
instagram_id: 123456789,
|
|
});
|
|
});
|
|
|
|
it('getInstagramInboxByInstagramId', () => {
|
|
const state = { records: inboxList };
|
|
expect(getters.getInstagramInboxByInstagramId(state)(123456789)).toEqual({
|
|
id: 7,
|
|
channel_id: 7,
|
|
name: 'Test Instagram 1',
|
|
channel_type: 'Channel::Instagram',
|
|
instagram_id: 123456789,
|
|
provider: 'default',
|
|
});
|
|
});
|
|
});
|