Removed outdated tests
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-04-21 16:20:43 +02:00
parent b2b8b47f56
commit cd12f75f25
2 changed files with 1 additions and 56 deletions

View File

@ -51,6 +51,7 @@ async function saveLanguage(value) {
await axios.patch(query, { await axios.patch(query, {
lang: value, lang: value,
}); });
user.value.lang = value;
} }
function logout() { function logout() {

View File

@ -1,56 +0,0 @@
import { describe, expect, it, jest } from '@jest/globals';
import { createWrapper, axios, flushPromises } from 'app/tests/jest/jestHelpers';
import UserPanel from '../UserPanel.vue';
const mockPush = jest.fn();
jest.mock('vue-router', () => ({
useRouter: () => ({
push: mockPush,
}),
}));
describe('UserPanel onMounted()', () => {
it('should define the user into state', async () => {
const userMock = {
user: {
id: 1,
name: 'myName',
nickname: 'myNickName',
lang: 'en',
userConfig: {
darkMode: 'false'
}
},
roles: []
}
const expectedUserData = {
id: 1,
name: 'myName',
nickname: 'myNickName',
lang: 'en',
darkMode: 'false'
}
jest.spyOn(axios, 'get').mockResolvedValue({ data: userMock });
const { vm } = createWrapper(UserPanel);
await flushPromises()
expect(vm.state.getUser().value).toEqual(expectedUserData);
});
it('should logout and notify the expected error', async () => {
jest.spyOn(axios, 'get').mockRejectedValue(new Error('error'));
const { vm } = createWrapper(UserPanel);
jest.spyOn(vm.quasar, 'notify');
await flushPromises()
expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining(
{ 'type': 'negative' }
));
});
});