Skip to content

Commit 63f285b

Browse files
author
Antoine de Chevigné
committed
fix frontend tests
1 parent 5a73265 commit 63f285b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/OpBatchDetail.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<v-container fluid>
33
<h2 class="text-h6 font-weight-medium">
4-
Batch <span class="text-grey-darken-1">#{{ batchIndex }}</span>
4+
Batch <span class="text-grey-darken-1">#{{ props.batchIndex }}</span>
55
</h2>
66
<v-divider class="my-4"></v-divider>
77

tests/unit/components/OpBatchDetail.spec.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import OpBatchDetail from '@/components/OpBatchDetail.vue';
22

3+
vi.mock('vue-router', () => ({
4+
useRouter: vi.fn(() => ({
5+
afterEach: vi.fn(),
6+
currentRoute: {
7+
value: {
8+
fullPath: '/batch/100',
9+
split: vi.fn(() => ['/batch/100'])
10+
}
11+
}
12+
}))
13+
}));
14+
15+
316
describe('OpBatchDetail.vue', () => {
417
it('Should call getOpBatchDetail on mount', async () => {
518
vi.spyOn(server, 'getOpBatchDetail')
@@ -13,7 +26,8 @@ describe('OpBatchDetail.vue', () => {
1326
batchIndex: '100'
1427
},
1528
global: {
16-
stubs: ['Hash-Link', 'router-link', 'HashLink']
29+
stubs: ['Hash-Link', 'router-link', 'HashLink'],
30+
provide: { $router: router }
1731
}
1832
});
1933

0 commit comments

Comments
 (0)