From 964dade4cfdf503ce751836a04d862b534d8eef6 Mon Sep 17 00:00:00 2001 From: Said Shah Date: Mon, 26 Oct 2020 13:49:53 -0400 Subject: [PATCH 1/3] Added tests for paragraphs --- src/atoms/typography/paragraph.test.tsx | 29 ++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/atoms/typography/paragraph.test.tsx b/src/atoms/typography/paragraph.test.tsx index d72c70b..94be953 100644 --- a/src/atoms/typography/paragraph.test.tsx +++ b/src/atoms/typography/paragraph.test.tsx @@ -1,5 +1,32 @@ import React from "react"; +import { render } from "@testing-library/react"; +import faker from "faker"; +import { Paragraph } from "./paragraph"; describe("Paragraph", () => { - test.skip("TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/15", () => {}); + test("when default props, renders paragraph with text", () => { + // Act + const expected = faker.random.words(); + + // Arrange + const { getByText } = render({expected}); + + // Assert + expect(getByText(expected)).not.toBeNil(); + }); + + test("when given cssClassName prop, renders paragraph with given class name", () => { + // Act + const expected = faker.random.words(); + const testClassName = faker.random.word(); + + // Arrange + const { container } = render( + {expected} + ); + const result = container.querySelector("." + testClassName); + + // Assert + expect(result).not.toBeNil(); + }); }); From 64ac63c806e775bf6fcdab056bb3c51e552d36aa Mon Sep 17 00:00:00 2001 From: Said Shah Date: Tue, 27 Oct 2020 12:59:51 -0400 Subject: [PATCH 2/3] Formatting --- src/atoms/typography/paragraph.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atoms/typography/paragraph.test.tsx b/src/atoms/typography/paragraph.test.tsx index 94be953..bf996f8 100644 --- a/src/atoms/typography/paragraph.test.tsx +++ b/src/atoms/typography/paragraph.test.tsx @@ -18,7 +18,7 @@ describe("Paragraph", () => { test("when given cssClassName prop, renders paragraph with given class name", () => { // Act const expected = faker.random.words(); - const testClassName = faker.random.word(); + const testClassName = faker.random.word().replace(/ /, ""); // Arrange const { container } = render( From 1bf30c7ecc903ade2663eff201560f451efd8a70 Mon Sep 17 00:00:00 2001 From: Said Shah Date: Tue, 27 Oct 2020 15:14:03 -0400 Subject: [PATCH 3/3] Updated text for css class name test --- src/atoms/typography/paragraph.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atoms/typography/paragraph.test.tsx b/src/atoms/typography/paragraph.test.tsx index bf996f8..afa0be3 100644 --- a/src/atoms/typography/paragraph.test.tsx +++ b/src/atoms/typography/paragraph.test.tsx @@ -18,7 +18,7 @@ describe("Paragraph", () => { test("when given cssClassName prop, renders paragraph with given class name", () => { // Act const expected = faker.random.words(); - const testClassName = faker.random.word().replace(/ /, ""); + const testClassName = "testClassName"; // Arrange const { container } = render(