Skip to content

Commit

Permalink
BreadCrumbs unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amirasalah committed Apr 1, 2020
1 parent e1a2e0b commit 864f52a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"files.autoSave": "afterDelay",
"editor.formatOnSave": true
}
26 changes: 26 additions & 0 deletions src/components/__tests__/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { cleanup, render } from "@testing-library/react";
import * as React from "react";

import Breadcrumbs from "../Breadcrumbs";

afterEach(cleanup);

it("renders items correctly", async () => {
const list = [
"Property location",
"About the works",
"Application",
"Declaration",
"Pay fee"
];
const active = 2;
const { getByText } = await render(
<Breadcrumbs active={active} list={list} />
);
expect(getByText("Property location")).toBeInTheDocument();
});

it("renders snapshot", () => {
const { asFragment } = render(<Breadcrumbs />);
expect(asFragment()).toMatchSnapshot();
});
40 changes: 40 additions & 0 deletions src/components/__tests__/__snapshots__/Breadcrumbs.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders snapshot 1`] = `
<DocumentFragment>
<div
class="MuiBox-root MuiBox-root-76"
>
<div
class="MuiContainer-root MuiContainer-maxWidthLg"
>
<div
class="MuiBox-root MuiBox-root-96 makeStyles-root-85"
>
<button
aria-controls="mobile-menu"
aria-haspopup="true"
class="MuiButtonBase-root makeStyles-moreBtn-91"
tabindex="0"
type="button"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
/>
</svg>
<span
class="MuiTouchRipple-root"
/>
</button>
</div>
</div>
</div>
</DocumentFragment>
`;

0 comments on commit 864f52a

Please sign in to comment.