2021-04-27 22:16:17 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
2021-04-28 21:53:59 +02:00
|
|
|
import { renderWithProvider } from '../../../../../test/jest';
|
2021-04-27 22:16:17 +02:00
|
|
|
import ViewOnEtherScanLink from '.';
|
|
|
|
|
|
|
|
const createProps = (customProps = {}) => {
|
|
|
|
return {
|
|
|
|
txHash:
|
|
|
|
'0x58e5a0fc7fbc849eddc100d44e86276168a8c7baaa5604e44ba6f5eb8ba1b7eb',
|
|
|
|
blockExplorerUrl: 'https://block.explorer',
|
|
|
|
isCustomBlockExplorerUrl: false,
|
|
|
|
...customProps,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('ViewOnEtherScanLink', () => {
|
|
|
|
it('renders the component with initial props', () => {
|
|
|
|
const { container, getByText } = renderWithProvider(
|
|
|
|
<ViewOnEtherScanLink {...createProps()} />,
|
|
|
|
);
|
2021-09-24 19:14:07 +02:00
|
|
|
expect(getByText('View Swap on Etherscan')).toBeInTheDocument();
|
2021-04-27 22:16:17 +02:00
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders the component with a custom block explorer link', () => {
|
|
|
|
const { container, getByText } = renderWithProvider(
|
|
|
|
<ViewOnEtherScanLink
|
|
|
|
{...createProps({
|
|
|
|
blockExplorerUrl: 'https://custom-blockchain.explorer',
|
|
|
|
isCustomBlockExplorerUrl: true,
|
|
|
|
})}
|
|
|
|
/>,
|
|
|
|
);
|
2021-09-24 19:14:07 +02:00
|
|
|
expect(
|
|
|
|
getByText('View Swap at custom-blockchain.explorer'),
|
|
|
|
).toBeInTheDocument();
|
2021-04-27 22:16:17 +02:00
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|