-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit testing setup for react-router (#15)
Unit testing setup for react-router
- Loading branch information
1 parent
41facba
commit 54f635b
Showing
12 changed files
with
2,200 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { flatRoutes } from "@react-router/fs-routes" | ||
|
||
export default flatRoutes() | ||
export default flatRoutes({ | ||
ignoredRouteFiles: ["**/*.test.{ts,tsx}"], | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import * as Module from "./_index" | ||
|
||
describe("Home route", () => { | ||
it("should render the home page text properly in english", async ({ | ||
renderStub, | ||
/** debug */ | ||
}) => { | ||
const { container } = await renderStub({ | ||
entries: [ | ||
{ | ||
id: "home", | ||
path: "/", | ||
Component: Module.default, | ||
}, | ||
], | ||
}) | ||
// debug() | ||
expect( | ||
container.queryByText("React Router is awesome!", { | ||
exact: false, | ||
}) | ||
).not.toBeNull() | ||
}) | ||
|
||
it("should render the home page text properly in bosnian", async ({ renderStub }) => { | ||
const { container } = await renderStub({ | ||
entries: [ | ||
{ | ||
id: "home", | ||
path: "/", | ||
Component: Module.default, | ||
}, | ||
], | ||
i18n: { | ||
lng: "bs", | ||
}, | ||
}) | ||
|
||
expect( | ||
container.queryByText("React Router je zakon!", { | ||
exact: false, | ||
}) | ||
).not.toBeNull() | ||
}) | ||
}) |
This file contains 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
Oops, something went wrong.