Created
September 26, 2020 17:03
-
-
Save adamjarling/a7c2b1da2621d77ed8c55a52500377cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { screen } from "@testing-library/react"; | |
import { | |
renderWithRouterApollo, | |
withReactHookForm, | |
} from "../../../services/testing-helpers"; | |
import ControlledMetadata from "./ControlledMetadata"; | |
describe("Some component", () => { | |
beforeEach(() => { | |
// Wrap with React Hook Form's Provider | |
const Wrapped = withReactHookForm(ControlledMetadata); | |
// Wrap with any other Providers you may be using, like ApolloProvider, React Router, etc. | |
return renderWithRouterApollo(<Wrapped />, | |
{ | |
mocks: [], | |
} | |
); | |
}); | |
// Your tested component will be wrapped with React Hook Form's provider (and others) | |
it("renders controlled metadata component", async () => { | |
expect(await screen.findByTestId("controlled-metadata")); | |
}); | |
... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment