11import React from "react" ;
22import faker from "faker" ;
3- import { LinkCard , IconClassName } from "./link-card" ;
3+ import { LinkCard , LinkCardIconClassName } from "./link-card" ;
44import { TestUtils } from "../../tests/test-utils" ;
55import { LinkCardTypes } from "../constants/link-card-types" ;
66
@@ -16,10 +16,10 @@ describe("LinkCard", () => {
1616 ) ;
1717
1818 //Assert
19- expect ( getByText ( expected ) ) . not . toBeNull ( ) ;
19+ expect ( getByText ( expected ) ) . not . toBeNil ( ) ;
2020 } ) ;
2121
22- test ( " when type prop is button, renders LinkCardTypes.Button" , ( ) => {
22+ test ( ` when type prop is button, renders ${ LinkCardTypes . Button } ` , ( ) => {
2323 // Arrange
2424 const expected = faker . random . words ( ) ;
2525 const label = faker . random . words ( ) ;
@@ -31,14 +31,13 @@ describe("LinkCard", () => {
3131 { expected }
3232 </ LinkCard >
3333 ) ;
34- const result = container . getElementsByTagName ( LinkCardTypes . Button ) [ 0 ] ;
34+ const result = container . getElementsByTagName ( "button" ) [ 0 ] ;
3535
3636 // Assert
37- expect ( result ) . not . toBeNull ( ) ;
38- expect ( container . innerHTML ) . toContain ( "button" ) ;
37+ expect ( result ) . not . toBeNil ( ) ;
3938 } ) ;
4039
41- test ( " when default props and include icon, renders with class name -with-icon" , ( ) => {
40+ test ( ` when default props and include icon, renders with class name ${ LinkCardIconClassName } ` , ( ) => {
4241 // Arrange
4342 const expected = faker . random . words ( ) ;
4443 const label = faker . random . words ( ) ;
@@ -49,10 +48,12 @@ describe("LinkCard", () => {
4948 { expected }
5049 </ LinkCard >
5150 ) ;
52- const result = container . getElementsByClassName ( IconClassName ) [ 0 ] ;
51+ const result = container . getElementsByClassName (
52+ LinkCardIconClassName
53+ ) [ 0 ] ;
5354
5455 // Assert
55- expect ( result ) . not . toBeNull ( ) ;
56- expect ( result . classList ) . toContain ( IconClassName ) ;
56+ expect ( result ) . not . toBeNil ( ) ;
57+ expect ( result . classList ) . toContain ( LinkCardIconClassName ) ;
5758 } ) ;
5859} ) ;
0 commit comments