Merge branch 'develop' into fix/show-toast-on-inbox-assignmement-error
This commit is contained in:
@@ -4,6 +4,7 @@ import AccountAPI from '../../api/account';
|
||||
import { differenceInDays } from 'date-fns';
|
||||
import EnterpriseAccountAPI from '../../api/enterprise/account';
|
||||
import { throwErrorMessage } from '../utils/api';
|
||||
import { getLanguageDirection } from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||
|
||||
const findRecordById = ($state, id) =>
|
||||
$state.records.find(record => record.id === Number(id)) || {};
|
||||
@@ -27,6 +28,13 @@ export const getters = {
|
||||
getUIFlags($state) {
|
||||
return $state.uiFlags;
|
||||
},
|
||||
isRTL: ($state, _, rootState) => {
|
||||
const accountId = rootState.route?.params?.accountId;
|
||||
if (!accountId) return false;
|
||||
|
||||
const { locale } = findRecordById($state, Number(accountId));
|
||||
return locale ? getLanguageDirection(locale) : false;
|
||||
},
|
||||
isTrialAccount: $state => id => {
|
||||
const account = findRecordById($state, id);
|
||||
const createdAt = new Date(account.created_at);
|
||||
|
||||
@@ -15,7 +15,7 @@ export const state = {
|
||||
|
||||
export const getters = {
|
||||
getAutomations(_state) {
|
||||
return _state.records;
|
||||
return _state.records.sort((a1, a2) => a1.id - a2.id);
|
||||
},
|
||||
getUIFlags(_state) {
|
||||
return _state.uiFlags;
|
||||
|
||||
@@ -18,6 +18,15 @@ const getters = {
|
||||
getCannedResponses(_state) {
|
||||
return _state.records;
|
||||
},
|
||||
getSortedCannedResponses(_state) {
|
||||
return sortOrder =>
|
||||
[..._state.records].sort((a, b) => {
|
||||
if (sortOrder === 'asc') {
|
||||
return a.short_code.localeCompare(b.short_code);
|
||||
}
|
||||
return b.short_code.localeCompare(a.short_code);
|
||||
});
|
||||
},
|
||||
getUIFlags(_state) {
|
||||
return _state.uiFlags;
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from './helpers/actionHelpers';
|
||||
import messageReadActions from './actions/messageReadActions';
|
||||
import messageTranslateActions from './actions/messageTranslateActions';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
|
||||
export const hasMessageFailedWithExternalError = pendingMessage => {
|
||||
// This helper is used to check if the message has failed with an external error.
|
||||
@@ -100,14 +101,24 @@ const actions = {
|
||||
},
|
||||
|
||||
fetchAllAttachments: async ({ commit }, conversationId) => {
|
||||
let attachments = null;
|
||||
|
||||
try {
|
||||
const { data } = await ConversationApi.getAllAttachments(conversationId);
|
||||
attachments = data.payload;
|
||||
} catch (error) {
|
||||
// in case of error, log the error and continue
|
||||
Sentry.setContext('Conversation', {
|
||||
id: conversationId,
|
||||
});
|
||||
Sentry.captureException(error);
|
||||
} finally {
|
||||
// we run the commit even if the request fails
|
||||
// this ensures that the `attachment` variable is always present on chat
|
||||
commit(types.SET_ALL_ATTACHMENTS, {
|
||||
id: conversationId,
|
||||
data: data.payload,
|
||||
data: attachments,
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ const getters = {
|
||||
);
|
||||
return selectedChat || {};
|
||||
},
|
||||
getSelectedChatAttachments: (_state, _getters) => {
|
||||
const selectedChat = _getters.getSelectedChat;
|
||||
return selectedChat.attachments || [];
|
||||
getSelectedChatAttachments: ({ selectedChatId, attachments }) => {
|
||||
return attachments[selectedChatId] || [];
|
||||
},
|
||||
getChatListFilters: ({ conversationFilters }) => conversationFilters,
|
||||
getLastEmailInSelectedChat: (stage, _getters) => {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { emitter } from 'shared/helpers/mitt';
|
||||
|
||||
const state = {
|
||||
allConversations: [],
|
||||
attachments: {},
|
||||
listLoadingStatus: true,
|
||||
chatStatusFilter: wootConstants.STATUS_TYPE.OPEN,
|
||||
chatSortFilter: wootConstants.SORT_BY_TYPE.LATEST,
|
||||
@@ -48,7 +49,6 @@ export const mutations = {
|
||||
allMessagesLoaded: existingConversation.allMessagesLoaded,
|
||||
messages: existingConversation.messages,
|
||||
dataFetched: existingConversation.dataFetched,
|
||||
attachments: existingConversation.attachments,
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -78,10 +78,10 @@ export const mutations = {
|
||||
}
|
||||
},
|
||||
[types.SET_ALL_ATTACHMENTS](_state, { id, data }) {
|
||||
const [chat] = _state.allConversations.filter(c => c.id === id);
|
||||
if (!chat) return;
|
||||
Vue.set(chat, 'attachments', []);
|
||||
chat.attachments.push(...data);
|
||||
const attachments = _state.attachments[id] || [];
|
||||
|
||||
attachments.push(...data);
|
||||
_state.attachments[id] = [...attachments];
|
||||
},
|
||||
[types.SET_MISSING_MESSAGES](_state, { id, data }) {
|
||||
const [chat] = _state.allConversations.filter(c => c.id === id);
|
||||
@@ -144,42 +144,40 @@ export const mutations = {
|
||||
Vue.set(chat, 'muted', false);
|
||||
},
|
||||
|
||||
[types.ADD_CONVERSATION_ATTACHMENTS]({ allConversations }, message) {
|
||||
const { conversation_id: conversationId } = message;
|
||||
const [chat] = getSelectedChatConversation({
|
||||
allConversations,
|
||||
selectedChatId: conversationId,
|
||||
[types.ADD_CONVERSATION_ATTACHMENTS](_state, message) {
|
||||
// early return if the message has not been sent, or has no attachments
|
||||
if (
|
||||
message.status !== MESSAGE_STATUS.SENT ||
|
||||
!message.attachments?.length
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = message.conversation_id;
|
||||
const existingAttachments = _state.attachments[id] || [];
|
||||
|
||||
const attachmentsToAdd = message.attachments.filter(attachment => {
|
||||
// if the attachment is not already in the store, add it
|
||||
// this is to prevent duplicates
|
||||
return !existingAttachments.some(
|
||||
existingAttachment => existingAttachment.id === attachment.id
|
||||
);
|
||||
});
|
||||
|
||||
if (!chat) return;
|
||||
|
||||
const isMessageSent =
|
||||
message.status === MESSAGE_STATUS.SENT && message.attachments;
|
||||
if (isMessageSent) {
|
||||
message.attachments.forEach(attachment => {
|
||||
if (!chat.attachments.some(a => a.id === attachment.id)) {
|
||||
chat.attachments.push(attachment);
|
||||
}
|
||||
});
|
||||
}
|
||||
// replace the attachments in the store
|
||||
_state.attachments[id] = [...existingAttachments, ...attachmentsToAdd];
|
||||
},
|
||||
|
||||
[types.DELETE_CONVERSATION_ATTACHMENTS]({ allConversations }, message) {
|
||||
const { conversation_id: conversationId } = message;
|
||||
const [chat] = getSelectedChatConversation({
|
||||
allConversations,
|
||||
selectedChatId: conversationId,
|
||||
[types.DELETE_CONVERSATION_ATTACHMENTS](_state, message) {
|
||||
if (message.status !== MESSAGE_STATUS.SENT) return;
|
||||
|
||||
const { conversation_id: id } = message;
|
||||
const existingAttachments = _state.attachments[id] || [];
|
||||
if (!existingAttachments.length) return;
|
||||
|
||||
_state.attachments[id] = existingAttachments.filter(attachment => {
|
||||
return attachment.message_id !== message.id;
|
||||
});
|
||||
|
||||
if (!chat) return;
|
||||
|
||||
const isMessageSent = message.status === MESSAGE_STATUS.SENT;
|
||||
if (isMessageSent) {
|
||||
const attachmentIndex = chat.attachments.findIndex(
|
||||
a => a.message_id === message.id
|
||||
);
|
||||
if (attachmentIndex !== -1) chat.attachments.splice(attachmentIndex, 1);
|
||||
}
|
||||
},
|
||||
|
||||
[types.ADD_MESSAGE]({ allConversations, selectedChatId }, message) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { actions } from '../actions';
|
||||
import * as types from '../../../mutation-types';
|
||||
import { uploadFile } from 'dashboard/helper/uploadHelper';
|
||||
|
||||
jest.mock('dashboard/helper/uploadHelper');
|
||||
vi.mock('dashboard/helper/uploadHelper');
|
||||
|
||||
const articleList = [
|
||||
{
|
||||
@@ -12,10 +12,10 @@ const articleList = [
|
||||
title: 'Documents are required to complete KYC',
|
||||
},
|
||||
];
|
||||
const commit = jest.fn();
|
||||
const dispatch = jest.fn();
|
||||
const commit = vi.fn();
|
||||
const dispatch = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#index', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../actions';
|
||||
import * as types from '../../../mutation-types';
|
||||
import { categoriesPayload } from './fixtures';
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#index', () => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { actions } from '../actions';
|
||||
import { types } from '../mutations';
|
||||
import { apiResponse } from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const dispatch = jest.fn();
|
||||
const commit = vi.fn();
|
||||
const dispatch = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#index', () => {
|
||||
|
||||
@@ -20,28 +20,18 @@ const state = {
|
||||
},
|
||||
};
|
||||
|
||||
const isAValidAppIntegration = integration => {
|
||||
return [
|
||||
'dialogflow',
|
||||
'dyte',
|
||||
'google_translate',
|
||||
'openai',
|
||||
'linear',
|
||||
].includes(integration.id);
|
||||
};
|
||||
export const getters = {
|
||||
getIntegrations($state) {
|
||||
return $state.records.filter(item => !isAValidAppIntegration(item));
|
||||
},
|
||||
getAppIntegrations($state) {
|
||||
return $state.records.filter(item => isAValidAppIntegration(item));
|
||||
},
|
||||
getIntegration: $state => integrationId => {
|
||||
const [integration] = $state.records.filter(
|
||||
record => record.id === integrationId
|
||||
);
|
||||
return integration || {};
|
||||
return $state.records;
|
||||
},
|
||||
getIntegration:
|
||||
$state =>
|
||||
(integrationId, defaultValue = {}) => {
|
||||
const [integration] = $state.records.filter(
|
||||
record => record.id === integrationId
|
||||
);
|
||||
return integration || defaultValue;
|
||||
},
|
||||
getUIFlags($state) {
|
||||
return $state.uiFlags;
|
||||
},
|
||||
|
||||
@@ -12,9 +12,9 @@ const newAccountInfo = {
|
||||
accountName: 'Company two',
|
||||
};
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { getters } from '../../accounts';
|
||||
import * as languageHelpers from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||
|
||||
const accountData = {
|
||||
id: 1,
|
||||
name: 'Company one',
|
||||
locale: 'en',
|
||||
features: {
|
||||
auto_resolve_conversations: false,
|
||||
auto_resolve_conversations: true,
|
||||
agent_management: false,
|
||||
},
|
||||
};
|
||||
@@ -38,18 +39,45 @@ describe('#getters', () => {
|
||||
const state = {
|
||||
records: [accountData],
|
||||
};
|
||||
const rootGetters = {
|
||||
getCurrentUser: {
|
||||
type: 'SuperAdmin',
|
||||
},
|
||||
};
|
||||
expect(
|
||||
getters.isFeatureEnabledonAccount(
|
||||
state,
|
||||
null,
|
||||
null,
|
||||
rootGetters
|
||||
null
|
||||
)(1, 'auto_resolve_conversations')
|
||||
).toEqual(true);
|
||||
});
|
||||
|
||||
describe('isRTL', () => {
|
||||
it('returns false when accountId is not present', () => {
|
||||
const rootState = { route: { params: {} } };
|
||||
expect(getters.isRTL({}, null, rootState)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true for RTL language', () => {
|
||||
const state = {
|
||||
records: [{ id: 1, locale: 'ar' }],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
vi.spyOn(languageHelpers, 'getLanguageDirection').mockReturnValue(true);
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for LTR language', () => {
|
||||
const state = {
|
||||
records: [{ id: 1, locale: 'en' }],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
vi.spyOn(languageHelpers, 'getLanguageDirection').mockReturnValue(false);
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false when account is not found', () => {
|
||||
const state = {
|
||||
records: [],
|
||||
};
|
||||
const rootState = { route: { params: { accountId: '1' } } };
|
||||
expect(getters.isRTL(state, null, rootState)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../agentBots';
|
||||
import types from '../../../mutation-types';
|
||||
import { agentBotRecords } from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { actions } from '../../agents';
|
||||
import * as types from '../../../mutation-types';
|
||||
import agentList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const dispatch = jest.fn();
|
||||
const commit = vi.fn();
|
||||
const dispatch = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../attributes';
|
||||
import * as types from '../../../mutation-types';
|
||||
import attributesList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,23 +2,18 @@ import axios from 'axios';
|
||||
import Cookies from 'js-cookie';
|
||||
import { actions } from '../../auth';
|
||||
import * as types from '../../../mutation-types';
|
||||
import { setUser, clearCookiesOnLogout } from '../../../utils/api';
|
||||
import * as APIHelpers from '../../../utils/api';
|
||||
import '../../../../routes';
|
||||
|
||||
jest.mock('../../../../routes', () => {});
|
||||
jest.mock('../../../utils/api', () => ({
|
||||
setUser: jest.fn(),
|
||||
clearCookiesOnLogout: jest.fn(),
|
||||
getHeaderExpiry: jest.fn(),
|
||||
}));
|
||||
jest.mock('js-cookie', () => ({
|
||||
get: jest.fn(),
|
||||
}));
|
||||
vi.spyOn(APIHelpers, 'setUser');
|
||||
vi.spyOn(APIHelpers, 'clearCookiesOnLogout');
|
||||
vi.spyOn(APIHelpers, 'getHeaderExpiry');
|
||||
vi.spyOn(Cookies, 'get');
|
||||
|
||||
const commit = jest.fn();
|
||||
const dispatch = jest.fn();
|
||||
const commit = vi.fn();
|
||||
const dispatch = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#validityCheck', () => {
|
||||
@@ -28,7 +23,7 @@ describe('#actions', () => {
|
||||
headers: { expiry: 581842904 },
|
||||
});
|
||||
await actions.validityCheck({ commit });
|
||||
expect(setUser).toHaveBeenCalledTimes(1);
|
||||
expect(APIHelpers.setUser).toHaveBeenCalledTimes(1);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_CURRENT_USER, { id: 1, name: 'John' }],
|
||||
]);
|
||||
@@ -38,7 +33,7 @@ describe('#actions', () => {
|
||||
response: { status: 401 },
|
||||
});
|
||||
await actions.validityCheck({ commit });
|
||||
expect(clearCookiesOnLogout);
|
||||
expect(APIHelpers.clearCookiesOnLogout);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { getters } from '../../auth';
|
||||
|
||||
import '../../../../routes';
|
||||
|
||||
jest.mock('../../../../routes', () => {});
|
||||
describe('#getters', () => {
|
||||
describe('#isLoggedIn', () => {
|
||||
it('return correct value if user data is available', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../automations';
|
||||
import * as types from '../../../mutation-types';
|
||||
import automationsList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../bulkActions';
|
||||
import * as types from '../../../mutation-types';
|
||||
import payload from './fixtures';
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#create', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../campaigns';
|
||||
import * as types from '../../../mutation-types';
|
||||
import campaignList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import CannedResponses from '../../cannedResponse';
|
||||
|
||||
const CANNED_RESPONSES = [
|
||||
{ short_code: 'hello', content: 'Hi ' },
|
||||
{ short_code: 'ask', content: 'Ask questions' },
|
||||
{ short_code: 'greet', content: 'Good morning' },
|
||||
];
|
||||
|
||||
const getters = CannedResponses.getters;
|
||||
|
||||
describe('#getCannedResponses', () => {
|
||||
it('returns canned responses', () => {
|
||||
const state = { records: CANNED_RESPONSES };
|
||||
expect(getters.getCannedResponses(state)).toEqual(CANNED_RESPONSES);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getSortedCannedResponses', () => {
|
||||
it('returns sort canned responses in ascending order', () => {
|
||||
const state = { records: CANNED_RESPONSES };
|
||||
expect(getters.getSortedCannedResponses(state)('asc')).toEqual([
|
||||
CANNED_RESPONSES[1],
|
||||
CANNED_RESPONSES[2],
|
||||
CANNED_RESPONSES[0],
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns sort canned responses in descending order', () => {
|
||||
const state = { records: CANNED_RESPONSES };
|
||||
expect(getters.getSortedCannedResponses(state)('desc')).toEqual([
|
||||
CANNED_RESPONSES[0],
|
||||
CANNED_RESPONSES[2],
|
||||
CANNED_RESPONSES[1],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getUIFlags', () => {
|
||||
it('returns uiFlags', () => {
|
||||
const state = { uiFlags: { isFetching: true } };
|
||||
expect(getters.getUIFlags(state)).toEqual({ isFetching: true });
|
||||
});
|
||||
});
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
import * as types from '../../../mutation-types';
|
||||
import conversationList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../contactLabels';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../contactNotes';
|
||||
import * as types from '../../../mutation-types';
|
||||
import notesData from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -21,9 +21,9 @@ const filterQueryData = {
|
||||
],
|
||||
};
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../conversationLabels';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { actions } from '../../conversationPage';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#setCurrentPage', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { actions } from '../../conversationSearch';
|
||||
import types from '../../../mutation-types';
|
||||
import axios from 'axios';
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../conversationStats';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { actions } from '../../conversationTypingStatus';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#create', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../conversationWatchers';
|
||||
import types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -15,10 +15,10 @@ const dataToSend = {
|
||||
};
|
||||
import { dataReceived } from './testConversationResponse';
|
||||
|
||||
const commit = jest.fn();
|
||||
const dispatch = jest.fn();
|
||||
const commit = vi.fn();
|
||||
const dispatch = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#hasMessageFailedWithExternalError', () => {
|
||||
it('returns false if message is sent', () => {
|
||||
@@ -292,7 +292,7 @@ describe('#actions', () => {
|
||||
|
||||
describe('#markMessagesRead', () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
it('sends correct mutations if api is successful', async () => {
|
||||
@@ -301,7 +301,7 @@ describe('#actions', () => {
|
||||
data: { id: 1, agent_last_seen_at: lastSeen },
|
||||
});
|
||||
await actions.markMessagesRead({ commit }, { id: 1 });
|
||||
jest.runAllTimers();
|
||||
vi.runAllTimers();
|
||||
expect(commit).toHaveBeenCalledTimes(1);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.UPDATE_MESSAGE_UNREAD_COUNT, { id: 1, lastSeen }],
|
||||
@@ -321,7 +321,7 @@ describe('#actions', () => {
|
||||
data: { id: 1, agent_last_seen_at: lastSeen, unread_count: 1 },
|
||||
});
|
||||
await actions.markMessagesUnread({ commit }, { id: 1 });
|
||||
jest.runAllTimers();
|
||||
vi.runAllTimers();
|
||||
expect(commit).toHaveBeenCalledTimes(1);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[
|
||||
|
||||
@@ -245,30 +245,18 @@ describe('#getters', () => {
|
||||
|
||||
describe('#getSelectedChatAttachments', () => {
|
||||
it('Returns attachments in selected chat', () => {
|
||||
const state = {};
|
||||
const getSelectedChat = {
|
||||
attachments: [
|
||||
{
|
||||
id: 1,
|
||||
file_name: 'test1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
file_name: 'test2',
|
||||
},
|
||||
const attachments = {
|
||||
1: [
|
||||
{ id: 1, file_name: 'test1' },
|
||||
{ id: 2, file_name: 'test2' },
|
||||
],
|
||||
};
|
||||
const selectedChatId = 1;
|
||||
expect(
|
||||
getters.getSelectedChatAttachments(state, { getSelectedChat })
|
||||
getters.getSelectedChatAttachments({ selectedChatId, attachments })
|
||||
).toEqual([
|
||||
{
|
||||
id: 1,
|
||||
file_name: 'test1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
file_name: 'test2',
|
||||
},
|
||||
{ id: 1, file_name: 'test1' },
|
||||
{ id: 2, file_name: 'test2' },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import types from '../../../mutation-types';
|
||||
import { mutations } from '../../conversations';
|
||||
|
||||
jest.mock('shared/helpers/mitt', () => ({
|
||||
vi.mock('shared/helpers/mitt', () => ({
|
||||
emitter: {
|
||||
emit: jest.fn(),
|
||||
on: jest.fn(),
|
||||
off: jest.fn(),
|
||||
emit: vi.fn(),
|
||||
on: vi.fn(),
|
||||
off: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -116,7 +116,7 @@ describe('#mutations', () => {
|
||||
});
|
||||
|
||||
it('add message to the conversation if it does not exist in the store', () => {
|
||||
global.bus = { $emit: jest.fn() };
|
||||
global.bus = { $emit: vi.fn() };
|
||||
const state = {
|
||||
allConversations: [{ id: 1, messages: [] }],
|
||||
selectedChatId: -1,
|
||||
@@ -144,7 +144,7 @@ describe('#mutations', () => {
|
||||
});
|
||||
|
||||
it('add message to the conversation and emit scrollToMessage if it does not exist in the store', () => {
|
||||
global.bus = { $emit: jest.fn() };
|
||||
global.bus = { $emit: vi.fn() };
|
||||
const state = {
|
||||
allConversations: [{ id: 1, messages: [] }],
|
||||
selectedChatId: 1,
|
||||
@@ -172,7 +172,7 @@ describe('#mutations', () => {
|
||||
});
|
||||
|
||||
it('update message if it exist in the store', () => {
|
||||
global.bus = { $emit: jest.fn() };
|
||||
global.bus = { $emit: vi.fn() };
|
||||
const state = {
|
||||
allConversations: [
|
||||
{
|
||||
@@ -313,7 +313,6 @@ describe('#mutations', () => {
|
||||
{
|
||||
id: 1,
|
||||
messages: [{ id: 1, content: 'test' }],
|
||||
attachments: [{ id: 1, name: 'test1.png' }],
|
||||
dataFetched: true,
|
||||
allMessagesLoaded: true,
|
||||
},
|
||||
@@ -325,7 +324,6 @@ describe('#mutations', () => {
|
||||
id: 1,
|
||||
name: 'test',
|
||||
messages: [{ id: 1, content: 'updated message' }],
|
||||
attachments: [{ id: 1, name: 'test.png' }],
|
||||
dataFetched: true,
|
||||
allMessagesLoaded: true,
|
||||
},
|
||||
@@ -335,7 +333,6 @@ describe('#mutations', () => {
|
||||
id: 1,
|
||||
name: 'test',
|
||||
messages: [{ id: 1, content: 'test' }],
|
||||
attachments: [{ id: 1, name: 'test1.png' }],
|
||||
dataFetched: true,
|
||||
allMessagesLoaded: true,
|
||||
},
|
||||
@@ -371,25 +368,28 @@ describe('#mutations', () => {
|
||||
it('set all attachments', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: {},
|
||||
};
|
||||
const data = [{ id: 1, name: 'test' }];
|
||||
mutations[types.SET_ALL_ATTACHMENTS](state, { id: 1, data });
|
||||
expect(state.allConversations[0].attachments).toEqual(data);
|
||||
expect(state.attachments[1]).toEqual(data);
|
||||
});
|
||||
it('set attachments key even if the attachments are empty', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: {},
|
||||
};
|
||||
const data = [];
|
||||
mutations[types.SET_ALL_ATTACHMENTS](state, { id: 1, data });
|
||||
expect(state.allConversations[0].attachments).toEqual([]);
|
||||
expect(state.attachments[1]).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#ADD_CONVERSATION_ATTACHMENTS', () => {
|
||||
it('add conversation attachments', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1, attachments: [] }],
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: {},
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 1,
|
||||
@@ -398,19 +398,13 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.ADD_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toEqual(
|
||||
message.attachments
|
||||
);
|
||||
expect(state.attachments[1]).toEqual(message.attachments);
|
||||
});
|
||||
|
||||
it('should not add duplicate attachments', () => {
|
||||
const state = {
|
||||
allConversations: [
|
||||
{
|
||||
id: 1,
|
||||
attachments: [{ id: 1, name: 'existing' }],
|
||||
},
|
||||
],
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: { 1: [{ id: 1, name: 'existing' }] },
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 1,
|
||||
@@ -422,12 +416,12 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.ADD_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toHaveLength(2);
|
||||
expect(state.allConversations[0].attachments).toContainEqual({
|
||||
expect(state.attachments[1]).toHaveLength(2);
|
||||
expect(state.attachments[1]).toContainEqual({
|
||||
id: 1,
|
||||
name: 'existing',
|
||||
});
|
||||
expect(state.allConversations[0].attachments).toContainEqual({
|
||||
expect(state.attachments[1]).toContainEqual({
|
||||
id: 2,
|
||||
name: 'new',
|
||||
});
|
||||
@@ -436,6 +430,9 @@ describe('#mutations', () => {
|
||||
it('should not add attachments if chat not found', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1, attachments: [] }],
|
||||
attachments: {
|
||||
1: [],
|
||||
},
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 2,
|
||||
@@ -444,14 +441,17 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.ADD_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toHaveLength(0);
|
||||
expect(state.attachments[1]).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#DELETE_CONVERSATION_ATTACHMENTS', () => {
|
||||
it('delete conversation attachments', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1, attachments: [{ id: 1, message_id: 1 }] }],
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: {
|
||||
1: [{ id: 1, message_id: 1 }],
|
||||
},
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 1,
|
||||
@@ -460,12 +460,15 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.DELETE_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toHaveLength(0);
|
||||
expect(state.attachments[1]).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should not delete attachments for non-matching message id', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1, attachments: [{ id: 1, message_id: 1 }] }],
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: {
|
||||
1: [{ id: 1, message_id: 1 }],
|
||||
},
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 1,
|
||||
@@ -474,12 +477,13 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.DELETE_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toHaveLength(1);
|
||||
expect(state.attachments[1]).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should not delete attachments if chat not found', () => {
|
||||
const state = {
|
||||
allConversations: [{ id: 1, attachments: [{ id: 1, message_id: 1 }] }],
|
||||
allConversations: [{ id: 1 }],
|
||||
attachments: { 1: [{ id: 1, message_id: 1 }] },
|
||||
};
|
||||
const message = {
|
||||
conversation_id: 2,
|
||||
@@ -488,7 +492,7 @@ describe('#mutations', () => {
|
||||
};
|
||||
|
||||
mutations[types.DELETE_CONVERSATION_ATTACHMENTS](state, message);
|
||||
expect(state.allConversations[0].attachments).toHaveLength(1);
|
||||
expect(state.attachments[1]).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../csat';
|
||||
import types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../customViews';
|
||||
import * as types from '../../../mutation-types';
|
||||
import { customViewList, updateCustomViewList } from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../dashboardApps';
|
||||
import types from '../../../mutation-types';
|
||||
import { payload, automationsList } from './fixtures';
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../draftMessages';
|
||||
import types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#set', () => {
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions, types } from '../../inboxAssignableAgents';
|
||||
import agentsData from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#fetch', () => {
|
||||
|
||||
@@ -3,14 +3,14 @@ import { actions } from '../../inboxes';
|
||||
import * as types from '../../../mutation-types';
|
||||
import inboxList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
const mockedGet = jest.fn(url => {
|
||||
const mockedGet = vi.fn(url => {
|
||||
if (url === '/api/v1/inboxes') {
|
||||
return Promise.resolve({ data: { payload: inboxList } });
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../integrations';
|
||||
import types from '../../../mutation-types';
|
||||
import integrationsList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
const errorMessage = { message: 'Incorrect header' };
|
||||
describe('#actions', () => {
|
||||
|
||||
@@ -1,60 +1,9 @@
|
||||
import { getters } from '../../integrations';
|
||||
|
||||
describe('#getters', () => {
|
||||
it('getIntegrations', () => {
|
||||
const state = {
|
||||
records: [
|
||||
{
|
||||
id: 'test1',
|
||||
name: 'test1',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: 'test2',
|
||||
name: 'test2',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: 'dyte',
|
||||
name: 'dyte',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: 'dialogflow',
|
||||
name: 'dialogflow',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(getters.getIntegrations(state)).toEqual([
|
||||
{
|
||||
id: 'test1',
|
||||
name: 'test1',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: 'test2',
|
||||
name: 'test2',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('getAppIntegrations', () => {
|
||||
const state = {
|
||||
records: [
|
||||
{
|
||||
id: 'test1',
|
||||
name: 'test1',
|
||||
logo: 'test',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: 'dyte',
|
||||
name: 'dyte',
|
||||
|
||||
@@ -3,14 +3,14 @@ import { actions } from '../../labels';
|
||||
import * as types from '../../../mutation-types';
|
||||
import labelsList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
const mockedGet = jest.fn(url => {
|
||||
const mockedGet = vi.fn(url => {
|
||||
if (url === '/api/v1/labels') {
|
||||
return Promise.resolve({ data: { payload: labelsList } });
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../macros';
|
||||
import * as types from '../../../mutation-types';
|
||||
import macrosList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import axios from 'axios';
|
||||
import { actions } from '../../notifications/actions';
|
||||
import types from '../../../mutation-types';
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import axios from 'axios';
|
||||
import { actions } from '../../reports';
|
||||
import DownloadHelper from 'dashboard/helper/downloadHelper';
|
||||
global.open = jest.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
import * as DownloadHelper from 'dashboard/helper/downloadHelper';
|
||||
|
||||
jest.mock('dashboard/helper/downloadHelper', () => ({
|
||||
downloadCsvFile: jest.fn(),
|
||||
}));
|
||||
global.open = vi.fn();
|
||||
global.axios = axios;
|
||||
|
||||
vi.mock('axios');
|
||||
vi.spyOn(DownloadHelper, 'downloadCsvFile');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#downloadAgentReports', () => {
|
||||
|
||||
@@ -3,13 +3,13 @@ import { actions } from '../../sla';
|
||||
import * as types from '../../../mutation-types';
|
||||
import SLAList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../SLAReports';
|
||||
import appliedSlas from './fixtures';
|
||||
import types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
} from '../../teamMembers';
|
||||
import teamMembers from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -10,14 +10,14 @@ import {
|
||||
} from '../../teams/types';
|
||||
import teamsList from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
const mockedGet = jest.fn(url => {
|
||||
const mockedGet = vi.fn(url => {
|
||||
if (url === '/api/v1/teams') {
|
||||
return Promise.resolve({ data: teamsList[1] });
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@ import axios from 'axios';
|
||||
import { actions } from '../../userNotificationSettings';
|
||||
import * as types from '../../../mutation-types';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { actions } from '../../webhooks';
|
||||
import * as types from '../../../mutation-types';
|
||||
import webhooks from './fixtures';
|
||||
|
||||
const commit = jest.fn();
|
||||
const commit = vi.fn();
|
||||
global.axios = axios;
|
||||
jest.mock('axios');
|
||||
vi.mock('axios');
|
||||
|
||||
describe('#actions', () => {
|
||||
describe('#get', () => {
|
||||
|
||||
Reference in New Issue
Block a user