1- import React from 'react' ;
21import { render } from '@testing-library/react' ;
32
4- import Cutout from './Cutout' ;
3+ import { Cutout } from './Cutout' ;
54
65describe ( '<Cutout />' , ( ) => {
76 it ( 'should render cutout' , ( ) => {
87 const { container } = render ( < Cutout /> ) ;
9- const cutout = container . firstChild ;
8+ const cutout = container . firstElementChild ;
109
1110 expect ( cutout ) . toBeInTheDocument ( ) ;
1211 } ) ;
@@ -15,7 +14,7 @@ describe('<Cutout />', () => {
1514 const { container } = render (
1615 < Cutout style = { { backgroundColor : 'papayawhip' } } />
1716 ) ;
18- const cutout = container . firstChild ;
17+ const cutout = container . firstElementChild ;
1918
2019 expect ( cutout ) . toHaveAttribute ( 'style' , 'background-color: papayawhip;' ) ;
2120 } ) ;
@@ -34,7 +33,7 @@ describe('<Cutout />', () => {
3433 it ( 'should render custom props' , ( ) => {
3534 const customProps = { title : 'cutout' } ;
3635 const { container } = render ( < Cutout { ...customProps } /> ) ;
37- const cutout = container . firstChild ;
36+ const cutout = container . firstElementChild ;
3837
3938 expect ( cutout ) . toHaveAttribute ( 'title' , 'cutout' ) ;
4039 } ) ;
0 commit comments