1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/pages/swaps/notification-page/notification-page.test.js

49 lines
1.7 KiB
JavaScript
Raw Normal View History

2023-06-15 20:17:21 +02:00
import React from 'react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import {
renderWithProvider,
createSwapsMockStore,
} from '../../../../test/jest';
import { QUOTES_EXPIRED_ERROR } from '../../../../shared/constants/swaps';
import NotificationPage from './notification-page';
const middleware = [thunk];
describe('NotificationPage', () => {
it('renders the component with the QUOTES_EXPIRED_ERROR', () => {
const mockStore = createSwapsMockStore();
const store = configureMockStore(middleware)(mockStore);
const { getByText } = renderWithProvider(
<NotificationPage notificationKey={QUOTES_EXPIRED_ERROR} />,
store,
);
expect(getByText('Are you still there?')).toBeInTheDocument();
expect(
getByText(
'Were ready to show you the latest quotes when you want to continue',
),
).toBeInTheDocument();
expect(getByText('Show latest quotes')).toBeInTheDocument();
expect(getByText('Terms of service')).toBeInTheDocument();
});
it('renders the component with an unsupported error key', () => {
const mockStore = createSwapsMockStore();
const store = configureMockStore(middleware)(mockStore);
const { getByText, queryByText } = renderWithProvider(
<NotificationPage notificationKey="unsupportedNotificationKey" />,
store,
);
expect(queryByText('Are you still there?')).not.toBeInTheDocument();
expect(
queryByText(
'Were ready to show you the latest quotes when you want to continue',
),
).not.toBeInTheDocument();
expect(queryByText('Show latest quotes')).not.toBeInTheDocument();
expect(getByText('Terms of service')).toBeInTheDocument();
});
});