Skip to content

Commit

Permalink
Add separate test for falsy children in Switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbuck authored and molefrog committed Sep 8, 2021
1 parent 1255892 commit f7f735a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/switch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,24 @@ it("ignores mixed children", () => {
<Switch>
Here is a<Route path="/users">route</Route>
route
</Switch>
);

const rendered = result.children[0].children;

expect(rendered.length).toBe(1);
expect(rendered[0].type).toBe(Route);
});

it("ignores falsy children", () => {
const result = testRouteRender(
"/users",
<Switch>
{""}
{false}
{null}
{undefined}
<Route path="/users">route</Route>
</Switch>
);

Expand Down

0 comments on commit f7f735a

Please sign in to comment.