bv toaster in Dashboard Layout

This commit is contained in:
Moriz Wahl 2022-02-16 07:43:09 +01:00
parent fcd89dd139
commit abfae25c7b
2 changed files with 6 additions and 8 deletions

View File

@ -2,6 +2,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import DashboardLayoutGdd from './DashboardLayout_gdd'
import { toasters } from '../../mixins/toaster'
jest.useFakeTimers()
jest.setTimeout(30000)
@ -16,7 +18,8 @@ const apolloMock = jest.fn().mockResolvedValue({
logout: 'success',
},
})
const toasterMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
describe('DashboardLayoutGdd', () => {
let wrapper
@ -38,11 +41,6 @@ describe('DashboardLayoutGdd', () => {
path: '/overview',
},
},
$toasted: {
global: {
error: toasterMock,
},
},
$apollo: {
query: apolloMock,
},
@ -220,7 +218,7 @@ describe('DashboardLayoutGdd', () => {
})
it('calls $toasted.global.error method', () => {
expect(toasterMock).toBeCalledWith('Ouch!')
expect(toastErrorSpy).toBeCalledWith('Ouch!')
})
})

View File

@ -102,7 +102,7 @@ export default {
.catch((error) => {
this.pending = true
this.transactionCount = -1
this.$toasted.global.error(error.message)
this.toastError(error.message)
// what to do when loading balance fails?
})
},