1- import React , { PropsWithChildren } from 'react' ;
21import { act , screen , waitFor , within } from '@testing-library/react' ;
3- import NotificationCenterProvider , {
4- InternalNotification ,
5- Notification ,
6- } from '../NotificationCenterProvider' ;
7- import NotificationCenter from './NotificationCenter' ;
82import userEvent from '@testing-library/user-event' ;
3+ import { PropsWithChildren } from 'react' ;
94import { QueryClient } from 'react-query' ;
10- import { prepareRenderMultipleHooks } from './__TESTS__/testMultipleHooks' ;
115import { MemoryRouter , Route , Routes } from 'react-router-dom' ;
126import { ShellHistoryProvider } from '../initFederation/ShellHistoryProvider' ;
13- import { useNotificationCenter } from '../useNotificationCenter' ;
7+ import NotificationCenterProvider , {
8+ InternalNotification ,
9+ Notification ,
10+ } from '../NotificationCenterProvider' ;
1411import { QueryClientProvider } from '../QueryClientProvider' ;
12+ import { useNotificationCenter } from '../useNotificationCenter' ;
13+ import { prepareRenderMultipleHooks } from './__TESTS__/testMultipleHooks' ;
14+ import NotificationCenter from './NotificationCenter' ;
15+ import { debug } from "jest-preview" ;
1516
16- export const notificationCenterSelectors = {
17+ const notificationCenterSelectors = {
1718 notificationCenterButton : ( ) =>
1819 screen . getByRole ( 'button' , { name : / n o t i f i c a t i o n c e n t e r / i } ) ,
1920 emptyNotificationCenterIcon : ( ) =>
@@ -175,21 +176,23 @@ describe('NotificationCenter', () => {
175176 //E open again the notification center
176177 userEvent . click ( notificationCenterSelectors . notificationCenterButton ( ) ) ;
177178 //V the notification are marked as read
179+ debug ( ) ;
180+
178181 expect (
179182 within ( screen . getAllByRole ( 'option' ) [ 0 ] ) . queryByRole ( 'img' , {
180- name : / u n r e a d n o t i f i c a t i o n m a r k / i,
181- } ) ,
182- ) . toBeNull ( ) ;
183+ name : / u n r e a d n o t i f i c a t i o n m a r k / i,
184+ } ) ,
185+ ) . not . toBeVisible ( ) ;
183186 expect (
184187 within ( screen . getAllByRole ( 'option' ) [ 1 ] ) . queryByRole ( 'img' , {
185188 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
186189 } ) ,
187- ) . toBeNull ( ) ;
190+ ) . not . toBeVisible ( ) ;
188191 expect (
189192 within ( screen . getAllByRole ( 'option' ) [ 2 ] ) . queryByRole ( 'img' , {
190193 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
191194 } ) ,
192- ) . toBeNull ( ) ;
195+ ) . not . toBeVisible ( ) ;
193196 } ) ;
194197
195198 it ( 'can be navigated with the keyboard' , async ( ) => {
@@ -241,7 +244,7 @@ describe('NotificationCenter', () => {
241244 within ( lastNotification ) . queryByRole ( 'img' , {
242245 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
243246 } ) ,
244- ) . toBeNull ( ) ;
247+ ) . not . toBeVisible ( ) ;
245248 } ) ;
246249
247250 it ( 'should not display notifications with the same ID' , async ( ) => {
@@ -267,17 +270,17 @@ describe('NotificationCenter', () => {
267270 within ( screen . getAllByRole ( 'option' ) [ 0 ] ) . queryByRole ( 'img' , {
268271 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
269272 } ) ,
270- ) . toBeNull ( ) ;
273+ ) . not . toBeVisible ( ) ;
271274 expect (
272275 within ( screen . getAllByRole ( 'option' ) [ 1 ] ) . queryByRole ( 'img' , {
273276 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
274277 } ) ,
275- ) . toBeNull ( ) ;
278+ ) . not . toBeVisible ( ) ;
276279 expect (
277280 within ( screen . getAllByRole ( 'option' ) [ 2 ] ) . queryByRole ( 'img' , {
278281 name : / u n r e a d n o t i f i c a t i o n m a r k / i,
279282 } ) ,
280- ) . toBeNull ( ) ;
283+ ) . not . toBeVisible ( ) ;
281284 //E
282285 userEvent . click ( notificationCenterSelectors . notificationCenterButton ( ) ) ;
283286 //V
0 commit comments