Changed the mocks for the test.

This commit is contained in:
Hannes Heine 2021-08-10 15:31:25 +02:00
parent e6ffd08db9
commit a10f5a3bcc

View File

@ -1,16 +1,11 @@
import { mount } from '@vue/test-utils'
import UserCardFormUsername from './UserCard_FormUsername'
import loginAPI from '../../../apis/loginAPI'
import flushPromises from 'flush-promises'
import { extend } from 'vee-validate'
jest.mock('../../../apis/loginAPI')
const localVue = global.localVue
const mockAPIcall = jest.fn((args) => {
return { success: true }
})
const mockAPIcall = jest.fn()
// override this rule to avoid API call
extend('gddUsernameUnique', {
@ -23,8 +18,6 @@ const toastErrorMock = jest.fn()
const toastSuccessMock = jest.fn()
const storeCommitMock = jest.fn()
loginAPI.changeUsernameProfile = mockAPIcall
describe('UserCard_FormUsername', () => {
let wrapper
@ -42,6 +35,9 @@ describe('UserCard_FormUsername', () => {
success: toastSuccessMock,
error: toastErrorMock,
},
$apollo: {
query: mockAPIcall,
},
}
const Wrapper = () => {