switch to bv toast

This commit is contained in:
Moriz Wahl 2022-02-16 08:05:35 +01:00
parent 72c5940e84
commit fec442ba51
2 changed files with 10 additions and 13 deletions

View File

@ -2,14 +2,17 @@ import { mount } from '@vue/test-utils'
import UserCardCoinAnimation from './UserCard_CoinAnimation'
import { updateUserInfos } from '../../../graphql/mutations'
import { toasters } from '../../../mixins/toaster'
const localVue = global.localVue
const mockAPIcall = jest.fn()
const toastErrorMock = jest.fn()
const toastSuccessMock = jest.fn()
const storeCommitMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_CoinAnimation', () => {
let wrapper
@ -22,12 +25,6 @@ describe('UserCard_CoinAnimation', () => {
},
commit: storeCommitMock,
},
$toasted: {
success: toastSuccessMock,
global: {
error: toastErrorMock,
},
},
$apollo: {
mutate: mockAPIcall,
},
@ -78,7 +75,7 @@ describe('UserCard_CoinAnimation', () => {
})
it('toasts a success message', () => {
expect(toastSuccessMock).toBeCalledWith('settings.coinanimation.True')
expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.True')
})
})
@ -109,7 +106,7 @@ describe('UserCard_CoinAnimation', () => {
})
it('toasts a success message', () => {
expect(toastSuccessMock).toBeCalledWith('settings.coinanimation.False')
expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.False')
})
})
@ -126,7 +123,7 @@ describe('UserCard_CoinAnimation', () => {
})
it('toasts an error message', () => {
expect(toastErrorMock).toBeCalledWith('Ouch')
expect(toastErrorSpy).toBeCalledWith('Ouch')
})
})
})

View File

@ -50,7 +50,7 @@ export default {
})
.then(() => {
this.$store.commit('coinanimation', this.CoinAnimationStatus)
this.$toasted.success(
this.toastSuccess(
this.CoinAnimationStatus
? this.$t('settings.coinanimation.True')
: this.$t('settings.coinanimation.False'),
@ -58,7 +58,7 @@ export default {
})
.catch((error) => {
this.CoinAnimationStatus = this.$store.state.coinanimation
this.$toasted.global.error(error.message)
this.toastError(error.message)
})
},
},