1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 04:37:13 +01:00
metamask-extension/ui/components/app/transaction-breakdown/transaction-breakdown-row/transaction-breakdown-row.component.test.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { shallow } from 'enzyme';
import Button from '../../../ui/button';
import TransactionBreakdownRow from './transaction-breakdown-row.component';
2018-08-31 21:36:07 +02:00
describe('TransactionBreakdownRow Component', () => {
it('should render text properly', () => {
2018-08-31 21:36:07 +02:00
const wrapper = shallow(
2020-11-03 00:41:28 +01:00
<TransactionBreakdownRow title="test" className="test-class">
2018-08-31 21:36:07 +02:00
Test
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
);
2018-08-31 21:36:07 +02:00
expect(wrapper.hasClass('transaction-breakdown-row')).toStrictEqual(true);
expect(
2020-11-03 00:41:28 +01:00
wrapper.find('.transaction-breakdown-row__title').text(),
).toStrictEqual('test');
expect(
2020-11-03 00:41:28 +01:00
wrapper.find('.transaction-breakdown-row__value').text(),
).toStrictEqual('Test');
});
2018-08-31 21:36:07 +02:00
it('should render components properly', () => {
2018-08-31 21:36:07 +02:00
const wrapper = shallow(
2020-11-03 00:41:28 +01:00
<TransactionBreakdownRow title="test" className="test-class">
<Button onClick={() => undefined}>Button</Button>
2018-08-31 21:36:07 +02:00
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
);
2018-08-31 21:36:07 +02:00
expect(wrapper.hasClass('transaction-breakdown-row')).toStrictEqual(true);
expect(
2020-11-03 00:41:28 +01:00
wrapper.find('.transaction-breakdown-row__title').text(),
).toStrictEqual('test');
expect(
wrapper.find('.transaction-breakdown-row__value').find(Button),
).toHaveLength(1);
});
});