From 3daf35d0b0c583837a8e96a765d54d3880aaff99 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Fri, 27 Sep 2019 19:40:25 +0300 Subject: [PATCH] Fix tests --- src/api/__mocks__/nodeInfo.js | 9 +++++++++ src/utils/request.js | 2 +- test/views/login/index.test.js | 1 + test/views/users/index.test.js | 1 + test/views/users/multipleUsersMenu.test.js | 1 + test/views/users/usersFilters.test.js | 1 + 6 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/api/__mocks__/nodeInfo.js diff --git a/src/api/__mocks__/nodeInfo.js b/src/api/__mocks__/nodeInfo.js new file mode 100644 index 00000000..6daf074e --- /dev/null +++ b/src/api/__mocks__/nodeInfo.js @@ -0,0 +1,9 @@ +export async function getNodeInfo(authHost) { + const data = { + metadata: { + mailerEnabled: true + } + } + + return Promise.resolve({ data }) +} diff --git a/src/utils/request.js b/src/utils/request.js index 271fe591..bbed6501 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -10,7 +10,7 @@ const service = axios.create({ service.interceptors.response.use( response => response, error => { - console.log('Error ' + error) + console.log(`Error ${error}`) console.log(error.response.data) // If there's an "error" property in the json, use it diff --git a/test/views/login/index.test.js b/test/views/login/index.test.js index b2986b5d..03e45667 100644 --- a/test/views/login/index.test.js +++ b/test/views/login/index.test.js @@ -16,6 +16,7 @@ localVue.use(Vuex) localVue.use(VueRouter) localVue.use(Element) +jest.mock('@/api/nodeInfo') jest.mock('@/api/login') describe('Login', () => { diff --git a/test/views/users/index.test.js b/test/views/users/index.test.js index 863186f3..d435e1ce 100644 --- a/test/views/users/index.test.js +++ b/test/views/users/index.test.js @@ -14,6 +14,7 @@ const localVue = createLocalVue() localVue.use(Vuex) localVue.use(Element) +jest.mock('@/api/nodeInfo') jest.mock('@/api/users') describe('Search and filter users', () => { diff --git a/test/views/users/multipleUsersMenu.test.js b/test/views/users/multipleUsersMenu.test.js index 355430e1..c92232bf 100644 --- a/test/views/users/multipleUsersMenu.test.js +++ b/test/views/users/multipleUsersMenu.test.js @@ -13,6 +13,7 @@ const localVue = createLocalVue() localVue.use(Vuex) localVue.use(Element) +jest.mock('@/api/nodeInfo') jest.mock('@/api/users') describe('Apply users actions to multiple users', () => { diff --git a/test/views/users/usersFilters.test.js b/test/views/users/usersFilters.test.js index 9cf14c66..e56822ca 100644 --- a/test/views/users/usersFilters.test.js +++ b/test/views/users/usersFilters.test.js @@ -13,6 +13,7 @@ const localVue = createLocalVue() localVue.use(Vuex) localVue.use(Element) +jest.mock('@/api/nodeInfo') jest.mock('@/api/users') describe('Filters users', () => {