From abfae25c7b30571030c8f47602d040f4476d081f Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 16 Feb 2022 07:43:09 +0100 Subject: [PATCH] bv toaster in Dashboard Layout --- .../src/views/Layout/DashboardLayout_gdd.spec.js | 12 +++++------- frontend/src/views/Layout/DashboardLayout_gdd.vue | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 4ea2e86b2..cdb71e4e1 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -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!') }) }) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 5e566d3f8..8f2f17a5d 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -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? }) },