mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
global spy on toasters
This commit is contained in:
parent
6e1ec70926
commit
1c3a3b6ee4
@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import DashboardLayoutGdd from './DashboardLayout_gdd'
|
import DashboardLayoutGdd from './DashboardLayout_gdd'
|
||||||
|
|
||||||
import { toasters } from '../../mixins/toaster'
|
import { toastErrorSpy } from '../../../test/testSetup'
|
||||||
|
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
|
|
||||||
@ -19,8 +19,6 @@ const apolloMock = jest.fn().mockResolvedValue({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
describe('DashboardLayoutGdd', () => {
|
describe('DashboardLayoutGdd', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
|
|||||||
import { GdtEntryType } from '../../../graphql/enums'
|
import { GdtEntryType } from '../../../graphql/enums'
|
||||||
import GdtTransactionList from './GdtTransactionList'
|
import GdtTransactionList from './GdtTransactionList'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -17,8 +17,6 @@ const apolloMock = jest.fn().mockResolvedValue({
|
|||||||
|
|
||||||
const windowScrollToMock = jest.fn()
|
const windowScrollToMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
window.scrollTo = windowScrollToMock
|
window.scrollTo = windowScrollToMock
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { RouterLinkStub, mount } from '@vue/test-utils'
|
|||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import Login from './Login'
|
import Login from './Login'
|
||||||
|
|
||||||
import { toasters } from '../../mixins/toaster'
|
import { toastErrorSpy } from '../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -27,8 +27,6 @@ const spinnerMock = jest.fn(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
describe('Login', () => {
|
describe('Login', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import Register from './Register'
|
import Register from './Register'
|
||||||
|
|
||||||
import { toasters } from '../../mixins/toaster'
|
import { toastErrorSpy } from '../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -21,8 +21,6 @@ const mockStoreCommit = jest.fn()
|
|||||||
const registerUserMutationMock = jest.fn()
|
const registerUserMutationMock = jest.fn()
|
||||||
const routerPushMock = jest.fn()
|
const routerPushMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
describe('Register', () => {
|
describe('Register', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import RegisterCommunity from './RegisterCommunity'
|
import RegisterCommunity from './RegisterCommunity'
|
||||||
|
|
||||||
import { toasters } from '../../mixins/toaster'
|
import { toastErrorSpy } from '../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -18,8 +18,6 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
|
|
||||||
const mockStoreCommit = jest.fn()
|
const mockStoreCommit = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
describe('RegisterCommunity', () => {
|
describe('RegisterCommunity', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import { communities, communityInfo } from '../../graphql/queries'
|
import { communities, communityInfo } from '../../graphql/queries'
|
||||||
import RegisterSelectCommunity from './RegisterSelectCommunity'
|
import RegisterSelectCommunity from './RegisterSelectCommunity'
|
||||||
|
|
||||||
import { toasters } from '../../mixins/toaster'
|
import { toastErrorSpy } from '../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -14,8 +14,6 @@ const spinnerMock = jest.fn(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
const apolloQueryMock = jest
|
const apolloQueryMock = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockResolvedValueOnce({
|
.mockResolvedValueOnce({
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import ResetPassword from './ResetPassword'
|
import ResetPassword from './ResetPassword'
|
||||||
import flushPromises from 'flush-promises'
|
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
|
// 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 routerPushMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
|
|
||||||
const stubs = {
|
const stubs = {
|
||||||
RouterLink: RouterLinkStub,
|
RouterLink: RouterLinkStub,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
|
|||||||
import UserCardCoinAnimation from './UserCard_CoinAnimation'
|
import UserCardCoinAnimation from './UserCard_CoinAnimation'
|
||||||
import { updateUserInfos } from '../../../graphql/mutations'
|
import { updateUserInfos } from '../../../graphql/mutations'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -10,9 +10,6 @@ const mockAPIcall = jest.fn()
|
|||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_CoinAnimation', () => {
|
describe('UserCard_CoinAnimation', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
|
|||||||
import UserCardFormUserData from './UserCard_FormUserData'
|
import UserCardFormUserData from './UserCard_FormUserData'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -10,9 +10,6 @@ const mockAPIcall = jest.fn()
|
|||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_FormUserData', () => {
|
describe('UserCard_FormUserData', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,13 @@ import { mount } from '@vue/test-utils'
|
|||||||
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const changePasswordProfileMock = jest.fn()
|
const changePasswordProfileMock = jest.fn()
|
||||||
changePasswordProfileMock.mockReturnValue({ success: true })
|
changePasswordProfileMock.mockReturnValue({ success: true })
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_FormUserPasswort', () => {
|
describe('UserCard_FormUserPasswort', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import UserCardFormUsername from './UserCard_FormUsername'
|
|||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import { extend } from 'vee-validate'
|
import { extend } from 'vee-validate'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -18,9 +18,6 @@ extend('gddUsernameUnique', {
|
|||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_FormUsername', () => {
|
describe('UserCard_FormUsername', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import UserCardLanguage from './UserCard_Language'
|
import UserCardLanguage from './UserCard_Language'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -15,9 +15,6 @@ const mockAPIcall = jest.fn().mockResolvedValue({
|
|||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_Language', () => {
|
describe('UserCard_Language', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
|
|||||||
import UserCardNewsletter from './UserCard_Newsletter'
|
import UserCardNewsletter from './UserCard_Newsletter'
|
||||||
import { unsubscribeNewsletter, subscribeNewsletter } from '../../../graphql/mutations'
|
import { unsubscribeNewsletter, subscribeNewsletter } from '../../../graphql/mutations'
|
||||||
|
|
||||||
import { toasters } from '../../../mixins/toaster'
|
import { toastErrorSpy, toastSuccessSpy } from '../../../../test/testSetup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -10,9 +10,6 @@ const mockAPIcall = jest.fn()
|
|||||||
|
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|
||||||
const toastErrorSpy = jest.spyOn(toasters.methods, 'toastError')
|
|
||||||
const toastSuccessSpy = jest.spyOn(toasters.methods, 'toastSuccess')
|
|
||||||
|
|
||||||
describe('UserCard_Newsletter', () => {
|
describe('UserCard_Newsletter', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,8 @@ import { focus } from 'vue-focus'
|
|||||||
import { loadAllRules } from '../src/validation-rules'
|
import { loadAllRules } from '../src/validation-rules'
|
||||||
|
|
||||||
import { toasters } from '../src/mixins/toaster'
|
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) => {
|
Object.keys(rules).forEach((rule) => {
|
||||||
extend(rule, {
|
extend(rule, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user