mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the mocks for the test.
This commit is contained in:
parent
e6ffd08db9
commit
a10f5a3bcc
@ -1,16 +1,11 @@
|
|||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import UserCardFormUsername from './UserCard_FormUsername'
|
import UserCardFormUsername from './UserCard_FormUsername'
|
||||||
import loginAPI from '../../../apis/loginAPI'
|
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import { extend } from 'vee-validate'
|
import { extend } from 'vee-validate'
|
||||||
|
|
||||||
jest.mock('../../../apis/loginAPI')
|
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const mockAPIcall = jest.fn((args) => {
|
const mockAPIcall = jest.fn()
|
||||||
return { success: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
// override this rule to avoid API call
|
// override this rule to avoid API call
|
||||||
extend('gddUsernameUnique', {
|
extend('gddUsernameUnique', {
|
||||||
@ -23,8 +18,6 @@ const toastErrorMock = jest.fn()
|
|||||||
const toastSuccessMock = jest.fn()
|
const toastSuccessMock = jest.fn()
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
loginAPI.changeUsernameProfile = mockAPIcall
|
|
||||||
|
|
||||||
describe('UserCard_FormUsername', () => {
|
describe('UserCard_FormUsername', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
@ -42,6 +35,9 @@ describe('UserCard_FormUsername', () => {
|
|||||||
success: toastSuccessMock,
|
success: toastSuccessMock,
|
||||||
error: toastErrorMock,
|
error: toastErrorMock,
|
||||||
},
|
},
|
||||||
|
$apollo: {
|
||||||
|
query: mockAPIcall,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user