-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 🧪 adds test case for app-notification
- Loading branch information
1 parent
85c695e
commit 5ac86ed
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
packages/core/src/App/Containers/__tests__/app-notification-messages.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import AppNotificationMessages from '../app-notification-messages'; | ||
|
||
jest.mock('Stores/connect', () => ({ | ||
__esModule: true, | ||
default: 'mockedDefaultExport', | ||
connect: | ||
() => | ||
<T,>(Component: T) => | ||
Component, | ||
})); | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
useLocation: jest.fn(() => ({ | ||
pathname: '/appstore/traders-hub', | ||
})), | ||
})); | ||
|
||
jest.mock('react-transition-group', () => ({ | ||
TransitionGroup: jest.fn(({ children }) => <div>{children}</div>), | ||
CSSTransition: jest.fn(({ children }) => <div>{children}</div>), | ||
})); | ||
|
||
jest.mock('../../Components/Elements/NotificationMessage', () => jest.fn(() => 'mockedNotification')); | ||
|
||
describe('AppNotificationMessages', () => { | ||
it('should render the component', () => { | ||
const mock_props = { | ||
marked_notifications: [], | ||
notification_messages: [ | ||
{ | ||
action: { | ||
route: '/account/financial-assessment', | ||
text: 'Start now', | ||
}, | ||
header: 'Pending action required', | ||
key: 'notify_financial_assessment', | ||
message: 'Please complete your financial assessment.', | ||
should_show_again: true, | ||
type: 'warning', | ||
}, | ||
], | ||
landing_company_shortcode: 'svg', | ||
has_iom_account: false, | ||
has_malta_account: false, | ||
is_logged_in: true, | ||
should_show_popups: true, | ||
}; | ||
render(<AppNotificationMessages {...mock_props} />); | ||
expect(screen.getByText('mockedNotification')).toBeInTheDocument(); | ||
}); | ||
}); |