fix(test): settle vector imports before teardown

This commit is contained in:
t8y2
2026-08-22 09:16:13 +00:00
parent 389faff8ee
commit 756d4aedc9
@@ -10,6 +10,13 @@ const backend = vi.hoisted(() => ({
vectorGetCollectionDetail: vi.fn(),
}));
vi.mock("vue", async (importOriginal) => {
const actual = await importOriginal<typeof import("vue")>();
return {
...actual,
defineAsyncComponent: () => actual.defineComponent({ render: () => null }),
};
});
vi.mock("vue-i18n", () => ({ useI18n: () => ({ t: (key: string) => key }) }));
vi.mock("@/lib/backend/api", () => backend);
vi.mock("@lucide/vue", async () => {
@@ -86,9 +93,11 @@ beforeEach(() => {
});
afterEach(async () => {
await vi.dynamicImportSettled();
await flushUi();
app?.unmount();
app = null;
await vi.dynamicImportSettled();
await flushUi();
root?.remove();
root = null;