Migrate all Vue components from Options API to <script setup>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,14 @@ vi.mock('@/module/apiError.js', () => ({
|
||||
default: vi.fn(),
|
||||
}));
|
||||
|
||||
const mockRoute = vi.hoisted(() => ({
|
||||
query: {},
|
||||
}));
|
||||
|
||||
vi.mock('vue-router', () => ({
|
||||
useRoute: () => mockRoute,
|
||||
}));
|
||||
|
||||
import Login from '@/views/Login/Login.vue';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
|
||||
@@ -15,18 +23,16 @@ describe('Login', () => {
|
||||
beforeEach(() => {
|
||||
pinia = createPinia();
|
||||
setActivePinia(pinia);
|
||||
mockRoute.query = {};
|
||||
});
|
||||
|
||||
const mountLogin = (options = {}) => {
|
||||
if (options.route?.query) {
|
||||
Object.assign(mockRoute.query, options.route.query);
|
||||
}
|
||||
return mount(Login, {
|
||||
global: {
|
||||
plugins: [pinia],
|
||||
mocks: {
|
||||
$route: {
|
||||
query: {},
|
||||
...options.route,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user