-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
27 lines (25 loc) · 737 Bytes
/
jest.setup.ts
File metadata and controls
27 lines (25 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { createApp } from 'vue';
import { config } from '@vue/test-utils';
import { createPinia } from 'pinia';
// Setup Pinia
config.global.plugins.push(createPinia());
// Mocking Vue Router to avoid test errors
jest.mock('vue-router', () => ({
createRouter: jest.fn(() => ({
push: jest.fn(),
replace: jest.fn()
// Add other router methods as needed for your tests
})),
createWebHistory: jest.fn(),
// If component uses useRoute or useRouter, mock them here
useRouter: () => ({
push: jest.fn()
// add other methods as necessary
}),
useRoute: () => ({
params: {},
query: {}
// add other route properties as necessary
})
}));