global spy on toasters

This commit is contained in:
Moriz Wahl 2022-02-16 11:07:08 +01:00
parent 6e1ec70926
commit 1c3a3b6ee4
14 changed files with 15 additions and 45 deletions

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import DashboardLayoutGdd from './DashboardLayout_gdd'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
jest.useFakeTimers()
@ -19,8 +19,6 @@ const apolloMock = jest.fn().mockResolvedValue({
},
})
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
describe('DashboardLayoutGdd', () => {
let wrapper

View File

@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
import { GdtEntryType } from '../../../graphql/enums'
import GdtTransactionList from './GdtTransactionList'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -17,8 +17,6 @@ const apolloMock = jest.fn().mockResolvedValue({
const windowScrollToMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
window.scrollTo = windowScrollToMock
const state = {

View File

@ -2,7 +2,7 @@ import { RouterLinkStub, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Login from './Login'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
const localVue = global.localVue
@ -27,8 +27,6 @@ const spinnerMock = jest.fn(() => {
}
})
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
describe('Login', () => {
let wrapper

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Register from './Register'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
const localVue = global.localVue
@ -21,8 +21,6 @@ const mockStoreCommit = jest.fn()
const registerUserMutationMock = jest.fn()
const routerPushMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
describe('Register', () => {
let wrapper

View File

@ -1,7 +1,7 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import RegisterCommunity from './RegisterCommunity'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
const localVue = global.localVue
@ -18,8 +18,6 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
const mockStoreCommit = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
describe('RegisterCommunity', () => {
let wrapper

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import { communities, communityInfo } from '../../graphql/queries'
import RegisterSelectCommunity from './RegisterSelectCommunity'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
const localVue = global.localVue
@ -14,8 +14,6 @@ const spinnerMock = jest.fn(() => {
}
})
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const apolloQueryMock = jest
.fn()
.mockResolvedValueOnce({

View File

@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import ResetPassword from './ResetPassword'
import flushPromises from 'flush-promises'
import { toasters } from '../../mixins/toaster'
import { toastErrorSpy } from '../../../test/testSetup'
// validation is tested in src/views/Pages/UserProfile/UserCard_FormUserPasswort.spec.js
@ -12,8 +12,6 @@ const apolloMutationMock = jest.fn()
const routerPushMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const stubs = {
RouterLink: RouterLinkStub,
}

View File

@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
import UserCardCoinAnimation from './UserCard_CoinAnimation'
import { updateUserInfos } from '../../../graphql/mutations'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -10,9 +10,6 @@ const mockAPIcall = 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

View File

@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
import UserCardFormUserData from './UserCard_FormUserData'
import flushPromises from 'flush-promises'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -10,9 +10,6 @@ const mockAPIcall = jest.fn()
const storeCommitMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_FormUserData', () => {
let wrapper

View File

@ -2,16 +2,13 @@ import { mount } from '@vue/test-utils'
import UserCardFormPasswort from './UserCard_FormUserPasswort'
import flushPromises from 'flush-promises'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
const changePasswordProfileMock = jest.fn()
changePasswordProfileMock.mockReturnValue({ success: true })
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_FormUserPasswort', () => {
let wrapper

View File

@ -3,7 +3,7 @@ import UserCardFormUsername from './UserCard_FormUsername'
import flushPromises from 'flush-promises'
import { extend } from 'vee-validate'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -18,9 +18,6 @@ extend('gddUsernameUnique', {
const storeCommitMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_FormUsername', () => {
let wrapper

View File

@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils'
import UserCardLanguage from './UserCard_Language'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -15,9 +15,6 @@ const mockAPIcall = jest.fn().mockResolvedValue({
const storeCommitMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_Language', () => {
let wrapper

View File

@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
import UserCardNewsletter from './UserCard_Newsletter'
import { unsubscribeNewsletter, subscribeNewsletter } from '../../../graphql/mutations'
import { toasters } from '../../../mixins/toaster'
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
const localVue = global.localVue
@ -10,9 +10,6 @@ const mockAPIcall = jest.fn()
const storeCommitMock = jest.fn()
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
describe('UserCard_Newsletter', () => {
let wrapper

View File

@ -18,6 +18,8 @@ import { focus } from 'vue-focus'
import { loadAllRules } from '../src/validation-rules'
import { toasters } from '../src/mixins/toaster'
export const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
export const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
Object.keys(rules).forEach((rule) => {
extend(rule, {