mock and instead of using vue router

This commit is contained in:
Moriz Wahl 2023-01-10 12:33:06 +01:00
parent 7cde62b843
commit 456b48650b

View File

@ -4,32 +4,12 @@ import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
import { createContribution, updateContribution, deleteContribution } from '@/graphql/mutations'
import { listContributions, listAllContributions, verifyLogin } from '@/graphql/queries'
import VueRouter from 'vue-router'
import routes from '../routes/routes'
const localVue = global.localVue
localVue.use(VueRouter)
const mockStoreDispach = jest.fn()
const apolloQueryMock = jest.fn()
const apolloMutationMock = jest.fn()
const router = new VueRouter({
base: '/',
routes,
linkActiveClass: 'active',
mode: 'history',
// scrollBehavior: (to, from, savedPosition) => {
// if (savedPosition) {
// return savedPosition
// }
// if (to.hash) {
// return { selector: to.hash }
// }
// return { x: 0, y: 0 }
// },
})
describe('Community', () => {
let wrapper
@ -49,12 +29,17 @@ describe('Community', () => {
$i18n: {
locale: 'en',
},
$router: {
push: jest.fn(),
},
$route: {
hash: 'my',
},
}
const Wrapper = () => {
return mount(Community, {
localVue,
router,
mocks,
})
}