11import React from "react" ;
22import faker from "faker" ;
3- import { LinkCard } from "./link-card" ;
3+ import { LinkCard , IconClassName } from "./link-card" ;
44import { TestUtils } from "../../tests/test-utils" ;
55import { LinkCardTypes } from "../constants/link-card-types" ;
66
77describe ( "LinkCard" , ( ) => {
8- test ( "When default props, renders LinkCard" , ( ) => {
8+ test ( "when default props, renders LinkCard" , ( ) => {
99 // Arrange
1010 const expected = faker . random . words ( ) ;
1111 const label = faker . random . words ( ) ;
@@ -19,7 +19,7 @@ describe("LinkCard", () => {
1919 expect ( getByText ( expected ) ) . not . toBeNull ( ) ;
2020 } ) ;
2121
22- test ( "When type prop is button, renders LinkCard with 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 ( ) ;
@@ -35,11 +35,10 @@ describe("LinkCard", () => {
3535
3636 // Assert
3737 expect ( result ) . not . toBeNull ( ) ;
38- expect ( result . classList ) . toContain ( "c-button" ) ;
3938 expect ( container . innerHTML ) . toContain ( "button" ) ;
4039 } ) ;
4140
42- test ( "When default props and include icon, renders with class name -with-icon" , ( ) => {
41+ test ( "when default props and include icon, renders with class name -with-icon" , ( ) => {
4342 // Arrange
4443 const expected = faker . random . words ( ) ;
4544 const label = faker . random . words ( ) ;
@@ -50,10 +49,10 @@ describe("LinkCard", () => {
5049 { expected }
5150 </ LinkCard >
5251 ) ;
53- const result = container . getElementsByClassName ( "-with-icon" ) [ 0 ] ;
52+ const result = container . getElementsByClassName ( IconClassName ) [ 0 ] ;
5453
5554 // Assert
5655 expect ( result ) . not . toBeNull ( ) ;
57- expect ( result . classList ) . toContain ( "-with-icon" ) ;
56+ expect ( result . classList ) . toContain ( IconClassName ) ;
5857 } ) ;
5958} ) ;
0 commit comments