Skip to content

Commit

Permalink
1,460th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed May 13, 2024
1 parent 860c18d commit 9d05265
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { VueWrapper } from '@vue/test-utils';
import { mount, flushPromises } from '@vue/test-utils';
import * as vueRouter from 'vue-router';
import * as xui from '@x/ui';
import todos from 'mock/todos/response';

Expand All @@ -13,6 +14,7 @@ let wrapper: VueWrapper;

afterEach(() => {
wrapper.unmount();
vi.clearAllMocks();
});

test('initial', async () => {
Expand All @@ -22,6 +24,15 @@ test('initial', async () => {
}
});

vi.mock('vue-router', async (importOriginal) => {
const actual = await importOriginal<typeof vueRouter>();

return {
...actual,
onBeforeRouteLeave: vi.fn(),
};
});

wrapper = mount(Page, { global: { plugins: [router, localer] } });

await flushPromises();
Expand Down

0 comments on commit 9d05265

Please sign in to comment.