Skip to content

Instantly share code, notes, and snippets.

@sbin0819
Created May 31, 2023 21:58
Show Gist options
  • Save sbin0819/e6329a891727dddc56f87d2ff2f4a05a to your computer and use it in GitHub Desktop.
Save sbin0819/e6329a891727dddc56f87d2ff2f4a05a to your computer and use it in GitHub Desktop.
```ts
import { render as renderComponent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
export const render = (
ui: React.ReactElement,
options?: Parameters<typeof renderComponent>[1],
) => {
const user = userEvent.setup();
const result = renderComponent(ui, options);
return {
...result,
user,
};
};
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment