Skip to content

Commit

Permalink
hack test
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Nov 26, 2023
1 parent 50f76d0 commit 673990c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 7 additions & 9 deletions src/addons/use-notification-center/NotificationCenter.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,14 @@ describe('NotificationCenter', () => {

it('listen for new notifications', () => {
cy.findByTestId('count').should('contain.text', 0);
cy.findByTestId('unreadCount')
.should('contain.text', 0)
.then(() => {
toast('msg');

cy.resolveEntranceAnimation();
cy.findByTestId('unreadCount').should('contain.text', 0);

cy.findByTestId('count').should('contain.text', 1, { timeout: 10000 });
cy.findByTestId('unreadCount').should('contain.text', 1);
});
// hacky asf???
cy.wait(1000).then(() => {
toast('msg');
cy.findByTestId('count').should('contain.text', 1, { timeout: 10000 });
cy.findByTestId('unreadCount').should('contain.text', 1);
});
});

it('add notification', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/addons/use-notification-center/useNotificationCenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export function useNotificationCenter<Data = {}>(
});

useEffect(() => {
return toast.onChange(toast => {
if (toast.status === 'added' || toast.status === 'updated') {
const newItem = decorate(toast as NotificationCenterItem<Data>);
return toast.onChange(item => {
if (item.status === 'added' || item.status === 'updated') {
const newItem = decorate(item as NotificationCenterItem<Data>);
if (filterFn.current && !filterFn.current(newItem)) return;

setNotifications(prev => {
Expand Down

0 comments on commit 673990c

Please sign in to comment.