mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import { TransactionType } from '../../../../shared/constants/transaction';
|
|
|
|
import mockState from '../../../../test/data/mock-state.json';
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|
|
|
import configureStore from '../../../store/store';
|
|
import ConfirmTitle from './confirm-title';
|
|
|
|
describe('ConfirmTitle', () => {
|
|
const store = configureStore(mockState);
|
|
|
|
it('should render title correctly', async () => {
|
|
const { findByText } = renderWithProvider(
|
|
<ConfirmTitle
|
|
txData={{
|
|
txParams: {},
|
|
}}
|
|
hexTransactionAmount="0x9184e72a000"
|
|
/>,
|
|
store,
|
|
);
|
|
expect(await findByText('0.00001')).toBeInTheDocument();
|
|
});
|
|
|
|
it('should return null if transaction is contract interation with 0 value', () => {
|
|
const { container } = renderWithProvider(
|
|
<ConfirmTitle
|
|
txData={{
|
|
txParams: {
|
|
value: '0x0',
|
|
},
|
|
type: TransactionType.contractInteraction,
|
|
}}
|
|
/>,
|
|
store,
|
|
);
|
|
expect(container.firstChild).toStrictEqual(null);
|
|
});
|
|
|
|
it('should render title if passed', () => {
|
|
const { getByText } = renderWithProvider(
|
|
<ConfirmTitle
|
|
txData={{
|
|
txParams: {},
|
|
}}
|
|
hexTransactionAmount="0x5"
|
|
title="dummy_title_passed"
|
|
/>,
|
|
store,
|
|
);
|
|
expect(getByText('dummy_title_passed')).toBeInTheDocument();
|
|
});
|
|
});
|