From 864f52aa73cc46a6ad164fa929ea5cf01132c63e Mon Sep 17 00:00:00 2001 From: amirasalah Date: Wed, 1 Apr 2020 18:59:04 +0200 Subject: [PATCH] BreadCrumbs unit tests --- .vscode/settings.json | 4 ++ src/components/__tests__/Breadcrumbs.tsx | 26 ++++++++++++ .../__snapshots__/Breadcrumbs.tsx.snap | 40 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 src/components/__tests__/Breadcrumbs.tsx create mode 100644 src/components/__tests__/__snapshots__/Breadcrumbs.tsx.snap diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..94b3bc2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "files.autoSave": "afterDelay", + "editor.formatOnSave": true +} \ No newline at end of file diff --git a/src/components/__tests__/Breadcrumbs.tsx b/src/components/__tests__/Breadcrumbs.tsx new file mode 100644 index 0000000..b9c30b7 --- /dev/null +++ b/src/components/__tests__/Breadcrumbs.tsx @@ -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( + + ); + expect(getByText("Property location")).toBeInTheDocument(); +}); + +it("renders snapshot", () => { + const { asFragment } = render(); + expect(asFragment()).toMatchSnapshot(); +}); diff --git a/src/components/__tests__/__snapshots__/Breadcrumbs.tsx.snap b/src/components/__tests__/__snapshots__/Breadcrumbs.tsx.snap new file mode 100644 index 0000000..d5e0d2a --- /dev/null +++ b/src/components/__tests__/__snapshots__/Breadcrumbs.tsx.snap @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders snapshot 1`] = ` + +
+
+
+ +
+
+
+
+`;