2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
2021-03-16 22:00:08 +01:00
|
|
|
import Button from '../../../ui/button';
|
|
|
|
import TransactionBreakdownRow from './transaction-breakdown-row.component';
|
2018-08-31 21:36:07 +02:00
|
|
|
|
2021-04-15 20:01:46 +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>,
|
2020-07-14 17:20:41 +02:00
|
|
|
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-08-31 21:36:07 +02:00
|
|
|
|
2021-04-15 20:01:46 +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(),
|
2021-04-15 20:01:46 +02:00
|
|
|
).toStrictEqual('test');
|
|
|
|
expect(
|
2020-11-03 00:41:28 +01:00
|
|
|
wrapper.find('.transaction-breakdown-row__value').text(),
|
2021-04-15 20:01:46 +02:00
|
|
|
).toStrictEqual('Test');
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-08-31 21:36:07 +02:00
|
|
|
|
2021-04-15 20:01:46 +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>,
|
2020-07-14 17:20:41 +02:00
|
|
|
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-08-31 21:36:07 +02:00
|
|
|
|
2021-04-15 20:01:46 +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(),
|
2021-04-15 20:01:46 +02:00
|
|
|
).toStrictEqual('test');
|
|
|
|
expect(
|
|
|
|
wrapper.find('.transaction-breakdown-row__value').find(Button),
|
|
|
|
).toHaveLength(1);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|