Skip to content

Commit 86c2647

Browse files
Merge pull request #58 from SaidShah/add-tests-for-atoms-paragraph
Added tests for paragraphs
2 parents 9d885be + 1bf30c7 commit 86c2647

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
import React from "react";
2+
import { render } from "@testing-library/react";
3+
import faker from "faker";
4+
import { Paragraph } from "./paragraph";
25

36
describe("Paragraph", () => {
4-
test.skip("TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/15", () => {});
7+
test("when default props, renders paragraph with text", () => {
8+
// Act
9+
const expected = faker.random.words();
10+
11+
// Arrange
12+
const { getByText } = render(<Paragraph>{expected}</Paragraph>);
13+
14+
// Assert
15+
expect(getByText(expected)).not.toBeNil();
16+
});
17+
18+
test("when given cssClassName prop, renders paragraph with given class name", () => {
19+
// Act
20+
const expected = faker.random.words();
21+
const testClassName = "testClassName";
22+
23+
// Arrange
24+
const { container } = render(
25+
<Paragraph cssClassName={testClassName}>{expected}</Paragraph>
26+
);
27+
const result = container.querySelector("." + testClassName);
28+
29+
// Assert
30+
expect(result).not.toBeNil();
31+
});
532
});

0 commit comments

Comments
 (0)