File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from "react" ;
2+ import faker from "faker" ;
3+ import { Heading } from "./heading" ;
4+ import { render } from "@testing-library/react" ;
25
36describe ( "Heading" , ( ) => {
4- test . skip ( "TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/14" , ( ) => { } ) ;
7+ test ( "when default props, renders heading" , ( ) => {
8+ // Assert
9+ const expected = faker . random . words ( ) ;
10+
11+ // Act
12+ const { getByText } = render ( < Heading > { expected } </ Heading > ) ;
13+
14+ // Assert
15+ expect ( getByText ( expected ) ) . not . toBeNil ( ) ;
16+ } ) ;
17+
18+ test ( "when given cssClassName prop, renders with given class name" , ( ) => {
19+ // Act
20+ const randomText = faker . random . words ( ) ;
21+ const testClassName = "testClassName" ;
22+
23+ // Arrange
24+ const { container } = render (
25+ < Heading cssClassName = { testClassName } > { randomText } </ Heading >
26+ ) ;
27+ const result = container . getElementsByClassName ( testClassName ) ;
28+
29+ // Assert
30+ expect ( result [ 0 ] ) . not . toBeNil ( ) ;
31+ } ) ;
532} ) ;
You can’t perform that action at this time.
0 commit comments