schlechtenburg/test/with-setup.ts

15 lines
366 B
TypeScript
Raw Permalink Normal View History

2024-10-08 07:15:26 +00:00
import { mount } from '@vue/test-utils';
2024-10-09 12:43:40 +00:00
import { defineComponent, Component } from 'vue'
2024-10-08 07:15:26 +00:00
2024-10-09 12:43:40 +00:00
export async function withSetup<T>(composable: () => T): Promise<T> {
return new Promise((resolve) => {
mount(defineComponent({
setup() {
resolve(composable());
// suppress missing template warning
return () => {}
}
}));
});
2024-10-08 07:15:26 +00:00
}