| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This directory contains the setup for testing react-router apps. It includes the setup.unit.tsx file which sets up the testing environment for unit tests.
The setup.unit.tsx file is used to set up the testing environment for unit tests in the following ways:
The renderStub function is used to render the react-router routes and return the container. It takes the following arguments:
The debug function is used to debug your unit tests with jest-preview. To use it, run your tests by running:
pnpm test:liveThis will run your tests in watch mode and you can use the debug function to debug your tests. This will do two things:
You can use the debug function to debug your tests by adding the following code to your test:
it("should do something", ({ debug }) => {
// Your test code here
debug()
})This will render the tests current state into the jest-preview server and you can use the debug function to debug your tests.
test("should do something", async ({ renderStub }) => {
// Your test code here
})test("should do something", async ({ renderStub }) => {
const { container } = await renderStub({
props: {
initialEntries: ["/"],
},
entries: [
{
id: "home",
path: "/",
Component: Home,
...Home,
},
],
})
})test("should do something", async ({ renderStub }) => {
const { container } = await renderStub({
props: {
initialEntries: ["/"],
},
entries: [
{
id: "home",
path: "/",
Component: Home,
...Home,
},
],
})
expect(container.queryByText("Home", { exact: false })).not.toBeNull()
})| Back | FazBrowse Home | New Git URL |