mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
|
import React from 'react';
|
||
|
import { renderWithProvider, screen, fireEvent } from '../../../../test/jest';
|
||
|
import configureStore from '../../../store/store';
|
||
|
import testData from '../../../../.storybook/test-data';
|
||
|
|
||
|
import { DetectedTokensBanner } from './detected-token-banner';
|
||
|
|
||
|
describe('DetectedTokensBanner', () => {
|
||
|
let setShowDetectedTokensSpy;
|
||
|
|
||
|
const args = {};
|
||
|
|
||
|
beforeEach(() => {
|
||
|
setShowDetectedTokensSpy = jest.fn();
|
||
|
args.actionButtonOnClick = setShowDetectedTokensSpy;
|
||
|
});
|
||
|
|
||
|
it('should render correctly', () => {
|
||
|
const store = configureStore(testData);
|
||
|
const { getByTestId, container } = renderWithProvider(
|
||
|
<DetectedTokensBanner {...args} />,
|
||
|
store,
|
||
|
);
|
||
|
|
||
|
expect(getByTestId('detected-token-banner')).toBeDefined();
|
||
|
expect(container).toMatchSnapshot();
|
||
|
});
|
||
|
it('should render number of tokens detected link', () => {
|
||
|
const store = configureStore(testData);
|
||
|
renderWithProvider(<DetectedTokensBanner {...args} />, store);
|
||
|
|
||
|
expect(
|
||
|
screen.getByText('3 new tokens found in this account'),
|
||
|
).toBeInTheDocument();
|
||
|
|
||
|
fireEvent.click(screen.getByText('Import tokens'));
|
||
|
expect(setShowDetectedTokensSpy).toHaveBeenCalled();
|
||
|
});
|
||
|
});
|