@ai-sdk/vue
Version:
[Vue.js](https://vuejs.org/) UI components for the [AI SDK](https://ai-sdk.dev/docs):
23 lines (19 loc) • 420 B
text/typescript
import { cleanup, render } from '@testing-library/vue';
import { beforeEach, afterEach, vi } from 'vitest';
export const setupTestComponent = (
TestComponent: any,
{
init,
}: {
init?: (TestComponent: any) => any;
} = {},
) => {
beforeEach(() => {
render(init?.(TestComponent) ?? TestComponent);
});
afterEach(() => {
vi.restoreAllMocks();
cleanup();
});
return TestComponent;
};