You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
4 years ago
|
import React from 'react';
|
||
|
|
||
4 years ago
|
import { renderWithProvider } from '../../../../../test/jest';
|
||
4 years ago
|
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()} />,
|
||
|
);
|
||
|
expect(getByText('View on Etherscan')).toBeInTheDocument();
|
||
|
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,
|
||
|
})}
|
||
|
/>,
|
||
|
);
|
||
|
expect(getByText('View at custom-blockchain.explorer')).toBeInTheDocument();
|
||
|
expect(container).toMatchSnapshot();
|
||
|
});
|
||
|
});
|