dev: Improve support for front end unit tests (#7163)

This commit is contained in:
miah
2026-05-31 10:41:52 -05:00
committed by GitHub
parent 7b0d1fde64
commit 364af97060
11 changed files with 719 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
import { mount } from "@vue/test-utils";
import { createI18n } from "vue-i18n";
function loadEnLocales() {
@@ -14,3 +15,12 @@ export function stubI18n() {
});
return i18n.global;
}
export const makeWrapper = <T>(setup: () => T) => {
const Wrapper = {
template: "<div />",
setup,
};
const { vm } = mount(Wrapper);
return vm as unknown as ReturnType<typeof Wrapper.setup>;
};