Skip to content

Instantly share code, notes, and snippets.

@bonnie
Created March 31, 2021 18:57
Show Gist options
  • Save bonnie/5a41422e4f425ff7eddff208c326b810 to your computer and use it in GitHub Desktop.
Save bonnie/5a41422e4f425ff7eddff208c326b810 to your computer and use it in GitHub Desktop.
import { render } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
// create a customRender that wraps the UI in a memory Router
const customRender = (ui, options) => {
return render(ui, { wrapper: MemoryRouter, ...options });
}
// re-export everything
export * from "@testing-library/react";
// override render method
export { customRender as render };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment