From 82777d868e693e10d2e22644fcd81c76d2a812bd Mon Sep 17 00:00:00 2001 From: Nick Foden Date: Mon, 14 Nov 2022 21:06:33 -0500 Subject: [PATCH 1/2] Add a footer and a couple tests --- Testing.MD | 14 ++++++++++++++ __tests__/__snapshots__/header.test.tsx.snap | 14 ++++++++++++++ __tests__/footer.test.tsx | 11 +++++++++++ __tests__/header.test.tsx | 10 ++++++++++ pages/_app.tsx | 14 +++++++++++--- src/components/Footer.tsx | 9 +++++++++ src/components/Header.tsx | 13 +++++++++++++ tsconfig.json | 2 +- 8 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 Testing.MD create mode 100644 __tests__/__snapshots__/header.test.tsx.snap create mode 100644 __tests__/footer.test.tsx create mode 100644 __tests__/header.test.tsx create mode 100644 src/components/Footer.tsx create mode 100644 src/components/Header.tsx diff --git a/Testing.MD b/Testing.MD new file mode 100644 index 0000000..e716aae --- /dev/null +++ b/Testing.MD @@ -0,0 +1,14 @@ +# Testing + +## TDD - Test Driven Development + +## Types of Test + +- Smoke Tests + Does it exist +- Unit Tests + Testing each item in isolation +- Snapshot Tests + Freeze it / i like it today +- Visual / UI Snapshot + Percy.IO diff --git a/__tests__/__snapshots__/header.test.tsx.snap b/__tests__/__snapshots__/header.test.tsx.snap new file mode 100644 index 0000000..aa9a595 --- /dev/null +++ b/__tests__/__snapshots__/header.test.tsx.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Header Looks Great 1`] = ` + + + +`; diff --git a/__tests__/footer.test.tsx b/__tests__/footer.test.tsx new file mode 100644 index 0000000..172ab2a --- /dev/null +++ b/__tests__/footer.test.tsx @@ -0,0 +1,11 @@ +import { render } from "@testing-library/react"; +import Footer from "../src/components/Footer"; + +describe("Footer", () => { + it("Has correct year", () => { + // const MockFooter = () => ; + const {getByText} = render(