use bv toaster

This commit is contained in:
Moriz Wahl 2022-02-16 07:47:47 +01:00
parent abfae25c7b
commit 66b9a822b2
3 changed files with 7 additions and 9 deletions

View File

@ -217,7 +217,7 @@ describe('DashboardLayoutGdd', () => {
expect(wrapper.vm.pending).toBeTruthy()
})
it('calls $toasted.global.error method', () => {
it('toasts the error message', () => {
expect(toastErrorSpy).toBeCalledWith('Ouch!')
})
})

View File

@ -2,6 +2,8 @@ import { mount } from '@vue/test-utils'
import { GdtEntryType } from '../../../graphql/enums'
import GdtTransactionList from './GdtTransactionList'
import { toasters } from '../../../mixins/toaster'
const localVue = global.localVue
const apolloMock = jest.fn().mockResolvedValue({
@ -13,9 +15,10 @@ const apolloMock = jest.fn().mockResolvedValue({
},
})
const toastErrorMock = jest.fn()
const windowScrollToMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
window.scrollTo = windowScrollToMock
const state = {
@ -36,11 +39,6 @@ describe('GdtTransactionList ', () => {
$t: jest.fn((t) => t),
$n: jest.fn((n) => n),
$d: jest.fn((d) => d),
$toasted: {
global: {
error: toastErrorMock,
},
},
$apollo: {
query: apolloMock,
},
@ -152,7 +150,7 @@ describe('GdtTransactionList ', () => {
})
it('toasts an error message', () => {
expect(toastErrorMock).toBeCalledWith('Ouch!')
expect(toastErrorSpy).toBeCalledWith('Ouch!')
})
})

View File

@ -71,7 +71,7 @@ export default {
window.scrollTo(0, 0)
})
.catch((error) => {
this.$toasted.global.error(error.message)
this.toastError(error.message)
})
},
},