1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00
metamask-extension/ui/pages/swaps/notification-page/notification-page.test.js
2023-06-15 20:17:21 +02:00

49 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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();
});
});