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 { render } from "@testing-library/react"; | |
import Locations from "./Locations"; | |
test("renders without error", () => { | |
render(<Locations />); | |
}); |
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 { 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"; |
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
const MemoryRouterWithInitialRoutes = ({ children }) => | |
<MemoryRouter>{children}</MemoryRouter>; | |
const customRender = (ui, options) => { | |
return render( | |
ui, | |
{ | |
wrapper: MemoryRouterWithInitialRoutes, | |
...options | |
} |
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
return render(ui, { | |
wrapper: (args) => | |
MemoryRouterWithInitialRoutes({ | |
...args, | |
initialRoutes, | |
}), | |
...options, | |
}); |
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
const initialRoutes = | |
options && options.initialRoutes ? options.initialRoutes : ["/"]; |
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
const MemoryRouterWithInitialRoutes = ({ children, initialRoutes }) => { | |
return ( | |
<MemoryRouter initialEntries={initialRoutes}> | |
{children} | |
</MemoryRouter> | |
); | |
}; |
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 { EnhancedStore } from "@reduxjs/toolkit"; // for redux-toolkit | |
// import { Store } from 'redux' // for non-toolkit | |
import { | |
render as rtlRender, | |
RenderOptions, | |
RenderResult, | |
} from "@testing-library/react"; | |
import { ReactElement, ReactNode } from "react"; | |
import { Provider } from "react-redux"; |
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
Show hidden characters
{ | |
"parser": "@typescript-eslint/parser", | |
"extends": ["airbnb", "prettier", "next"], | |
"plugins": [ | |
"testing-library", | |
"jest-dom", | |
"jsx-a11y", | |
"simple-import-sort", | |
"prettier", | |
"react-hooks" |
OlderNewer