Add nextTick to CreateUserAccount

- there were changes that moved vue-test-utils from synchronous to
asynchronous, which means we need to use nextTick before checking
certain attributes.
This commit is contained in:
mattwr18 2020-01-16 13:11:49 +01:00
parent 8c29ad947b
commit 3686a93878

View File

@ -1,8 +1,8 @@
import { config, mount } from '@vue/test-utils' import { config, mount } from '@vue/test-utils'
import Vue from 'vue'
import { VERSION } from '~/constants/terms-and-conditions-version.js' import { VERSION } from '~/constants/terms-and-conditions-version.js'
import CreateUserAccount from './CreateUserAccount' import CreateUserAccount from './CreateUserAccount'
import { SignupVerificationMutation } from '~/graphql/Registration.js' import { SignupVerificationMutation } from '~/graphql/Registration.js'
const localVue = global.localVue const localVue = global.localVue
config.stubs['sweetalert-icon'] = '<span><slot /></span>' config.stubs['sweetalert-icon'] = '<span><slot /></span>'
@ -110,6 +110,7 @@ describe('CreateUserAccount', () => {
it('displays success', async () => { it('displays success', async () => {
await action() await action()
await Vue.nextTick()
expect(mocks.$t).toHaveBeenCalledWith( expect(mocks.$t).toHaveBeenCalledWith(
'components.registration.create-user-account.success', 'components.registration.create-user-account.success',
) )
@ -140,6 +141,7 @@ describe('CreateUserAccount', () => {
it('displays form errors', async () => { it('displays form errors', async () => {
await action() await action()
await Vue.nextTick()
expect(mocks.$t).toHaveBeenCalledWith( expect(mocks.$t).toHaveBeenCalledWith(
'components.registration.create-user-account.error', 'components.registration.create-user-account.error',
) )