File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11import { render , screen } from '@testing-library/react' ;
22import Popup from './popup/Popup' ;
3- import { APP_INITIAL_POPUP_MSG } from './utility/constants' ;
43
54//clear local storage
65beforeEach ( ( ) => {
76 localStorage . clear ( ) ;
87} ) ;
98
10- describe ( 'App component' , ( ) => {
11- test ( ' renders popup with image, message, and button' , ( ) => {
9+ describe ( "popup component" , ( ) => {
10+ test ( " renders popup with image, message, and button" , ( ) => {
1211 const mockSetShowPopup = jest . fn ( ) ; //mock function
1312
1413 // Render the Popup component
@@ -18,8 +17,9 @@ describe('App component', () => {
1817 expect ( popupImage ) . toBeInTheDocument ( ) ;
1918 expect ( popupImage ) . toHaveAttribute ( 'src' , 'favicon1.ico' ) ;
2019
21- const message = screen . getByText ( APP_INITIAL_POPUP_MSG ) ;
22- expect ( message ) . toBeInTheDocument ( ) ;
20+ const boldText1 = document . querySelector ( 'b' ) ;
21+ expect ( boldText1 ) . toBeInTheDocument ( ) ;
22+ expect ( boldText1 . textContent ) . toBe ( 'myself' ) ;
2323
2424 //check ok button
2525 const button = screen . getByRole ( 'button' , { name :/ O K / i} ) ;
You can’t perform that action at this time.
0 commit comments