2023-09-19 06:15:36 +00:00
|
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
import { MemoryRouter } from 'react-router-dom';
|
|
|
|
import { Withdraw } from './withdraw';
|
|
|
|
|
|
|
|
jest.mock('../../components/withdraw-container', () => ({
|
|
|
|
WithdrawContainer: ({ assetId }: { assetId?: string }) => (
|
|
|
|
<div data-testid="assetId">{assetId}</div>
|
|
|
|
),
|
|
|
|
}));
|
|
|
|
|
2023-11-07 15:15:54 +00:00
|
|
|
jest.mock('../../components/welcome-dialog/get-started', () => ({
|
2023-09-19 06:15:36 +00:00
|
|
|
GetStarted: () => <div>GetStarted</div>,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const renderJsx = (route = '/withdraw') => {
|
|
|
|
render(
|
|
|
|
<MemoryRouter initialEntries={[route]}>
|
|
|
|
<Withdraw />
|
|
|
|
</MemoryRouter>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Withdraw page', () => {
|
|
|
|
it('assetId should be passed down', () => {
|
|
|
|
const assetId = 'foo';
|
|
|
|
const route = '/withdraw?assetId=' + assetId;
|
|
|
|
renderJsx(route);
|
|
|
|
expect(screen.getByTestId('assetId')).toHaveTextContent(assetId);
|
|
|
|
});
|
|
|
|
});
|