Enhancement: Upgrade @babel/preset-env (#542)
This commit is contained in:
parent
a790dc640f
commit
1261cc7783
7 changed files with 775 additions and 1690 deletions
|
@ -24,10 +24,12 @@ module.exports = {
|
|||
'multiline': {
|
||||
'max': 1,
|
||||
'allowFirstLine': false
|
||||
}
|
||||
},
|
||||
}],
|
||||
'vue/html-self-closing': 'off',
|
||||
"vue/no-v-html": 'off'
|
||||
"vue/no-v-html": 'off',
|
||||
'import/extensions': ['never']
|
||||
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
|
|
|
@ -11,7 +11,8 @@ export default {
|
|||
return m.messages.filter(
|
||||
chat =>
|
||||
chat.created_at * 1000 > m.agent_last_seen_at * 1000 &&
|
||||
(chat.message_type === 0 && chat.private !== true)
|
||||
chat.message_type === 0 &&
|
||||
chat.private !== true
|
||||
).length;
|
||||
},
|
||||
readMessages(m) {
|
||||
|
|
|
@ -42,7 +42,8 @@ const getters = {
|
|||
return chat.messages.filter(
|
||||
chatMessage =>
|
||||
chatMessage.created_at * 1000 > chat.agent_last_seen_at * 1000 &&
|
||||
(chatMessage.message_type === 0 && chatMessage.private !== true)
|
||||
chatMessage.message_type === 0 &&
|
||||
chatMessage.private !== true
|
||||
).length;
|
||||
},
|
||||
getChatStatusFilter: ({ chatStatusFilter }) => chatStatusFilter,
|
||||
|
|
|
@ -78,13 +78,19 @@ export const actions = {
|
|||
}
|
||||
},
|
||||
updateAutoAssignment: async ({ commit }, { id, ...inboxParams }) => {
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true });
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, {
|
||||
isUpdatingAutoAssignment: true,
|
||||
});
|
||||
try {
|
||||
const response = await InboxesAPI.update(id, inboxParams);
|
||||
commit(types.default.EDIT_INBOXES, response.data);
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false });
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, {
|
||||
isUpdatingAutoAssignment: false,
|
||||
});
|
||||
} catch (error) {
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false });
|
||||
commit(types.default.SET_INBOXES_UI_FLAG, {
|
||||
isUpdatingAutoAssignment: false,
|
||||
});
|
||||
throw new Error(error);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -91,28 +91,40 @@ describe('#actions', () => {
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('#updateAutoAssignment', () => {
|
||||
it('sends correct actions if API is success', async () => {
|
||||
let updatedInbox = inboxList[0];
|
||||
const updatedInbox = inboxList[0];
|
||||
updatedInbox.enable_auto_assignment = false;
|
||||
|
||||
axios.patch.mockResolvedValue({ data: updatedInbox });
|
||||
await actions.updateAutoAssignment({ commit }, { id: updatedInbox.id, inbox: { enable_auto_assignment: false} });
|
||||
await actions.updateAutoAssignment(
|
||||
{ commit },
|
||||
{ id: updatedInbox.id, inbox: { enable_auto_assignment: false } }
|
||||
);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true }],
|
||||
[types.default.EDIT_INBOXES, updatedInbox],
|
||||
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false }],
|
||||
[
|
||||
types.default.SET_INBOXES_UI_FLAG,
|
||||
{ isUpdatingAutoAssignment: false },
|
||||
],
|
||||
]);
|
||||
});
|
||||
it('sends correct actions if API is error', async () => {
|
||||
axios.patch.mockRejectedValue({ message: 'Incorrect header' });
|
||||
await expect(
|
||||
actions.updateAutoAssignment({ commit }, { id: inboxList[0].id, inbox: { enable_auto_assignment: false} })
|
||||
actions.updateAutoAssignment(
|
||||
{ commit },
|
||||
{ id: inboxList[0].id, inbox: { enable_auto_assignment: false } }
|
||||
)
|
||||
).rejects.toThrow(Error);
|
||||
expect(commit.mock.calls).toEqual([
|
||||
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: true }],
|
||||
[types.default.SET_INBOXES_UI_FLAG, { isUpdatingAutoAssignment: false }],
|
||||
[
|
||||
types.default.SET_INBOXES_UI_FLAG,
|
||||
{ isUpdatingAutoAssignment: false },
|
||||
],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.6.0",
|
||||
"@babel/preset-env": "~7.3.4",
|
||||
"@babel/preset-env": "~7.8.4",
|
||||
"@rails/actioncable": "^6.0.0",
|
||||
"@rails/webpacker": "^4.2.2",
|
||||
"axios": "^0.19.0",
|
||||
|
@ -58,7 +58,7 @@
|
|||
"@vue/babel-preset-app": "^3.11.0",
|
||||
"@vue/test-utils": "^1.0.0-beta.29",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"babel-jest": "^25.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-config-airbnb": "^17.1.0",
|
||||
|
|
Loading…
Reference in a new issue