1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-05 23:44:56 +01:00
metamask-extension/ui/app/components/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-08-31 21:36:07 +02:00
import React from 'react'
import assert from 'assert'
import { shallow } from 'enzyme'
import TransactionBreakdownRow from '../transaction-breakdown-row.component'
import Button from '../../../button'
describe('TransactionBreakdownRow Component', () => {
it('should render text properly', () => {
const wrapper = shallow(
<TransactionBreakdownRow
title="test"
className="test-class"
>
Test
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
)
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
assert.equal(wrapper.find('.transaction-breakdown-row__title').text(), 'test')
assert.equal(wrapper.find('.transaction-breakdown-row__value').text(), 'Test')
})
it('should render components properly', () => {
const wrapper = shallow(
<TransactionBreakdownRow
title="test"
className="test-class"
>
<Button onClick={() => {}} >Button</Button>
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
)
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
assert.equal(wrapper.find('.transaction-breakdown-row__title').text(), 'test')
assert.ok(wrapper.find('.transaction-breakdown-row__value').find(Button))
})
})