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.
Tag:
Branch:
Tree:
19ec45ef35
develop
feature/default_network_editable
v10.22.3
${ noResults }
92 lines
2.7 KiB
92 lines
2.7 KiB
import React from 'react';
|
|||
import sinon from 'sinon';
|
|||
|
import { shallowWithContext } from '../../../../../../test/lib/render-helpers';
|
||
import AdvancedTabContent from './advanced-tab-content.component';
|
|||
|
|||
describe('AdvancedTabContent Component', () => {
|
|||
let wrapper;
|
|||
|
|||
beforeEach(() => {
|
|||
const propsMethodSpies = {
|
|||
updateCustomGasPrice: sinon.spy(),
|
|||
updateCustomGasLimit: sinon.spy(),
|
|||
};
|
|||
sinon.spy(AdvancedTabContent.prototype, 'renderDataSummary');
|
|||
|
|||
|
wrapper = shallowWithContext(
|
||
|
<AdvancedTabContent
|
||
updateCustomGasPrice={propsMethodSpies.updateCustomGasPrice}
|
|||
updateCustomGasLimit={propsMethodSpies.updateCustomGasLimit}
|
|||
customModalGasPriceInHex="11"
|
|||
customModalGasLimitInHex="23456"
|
|||
transactionFee="$0.25"
|
|||
insufficientBalance={false}
|
|||
customPriceIsSafe
|
|||
isSpeedUp={false}
|
|||
|
/>,
|
||
);
|
|||
});
|
|||
|
|||
afterEach(() => {
|
|||
sinon.restore();
|
|||
});
|
|||
|
|||
describe('render()', () => {
|
|||
it('should render the advanced-tab root node', () => {
|
|||
expect(wrapper.hasClass('advanced-tab')).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('should render the expected child of the advanced-tab div', () => {
|
|||
const advancedTabChildren = wrapper.children();
|
|||
expect(advancedTabChildren).toHaveLength(2);
|
|||
|
|||
expect(
|
|||
|
advancedTabChildren
|
||
.at(0)
|
|||
.hasClass('advanced-tab__transaction-data-summary'),
|
|||
).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('should call renderDataSummary with the expected params', () => {
|
|||
|
const renderDataSummaryArgs = AdvancedTabContent.prototype.renderDataSummary.getCall(
|
||
0,
|
|||
).args;
|
|||
expect(renderDataSummaryArgs).toStrictEqual(['$0.25']);
|
|||
});
|
|||
});
|
|||
|
|||
describe('renderDataSummary()', () => {
|
|||
let dataSummary;
|
|||
|
|||
beforeEach(() => {
|
|||
|
dataSummary = shallowWithContext(
|
||
wrapper.instance().renderDataSummary('mockTotalFee'),
|
|||
);
|
|||
});
|
|||
|
|||
it('should render the transaction-data-summary root node', () => {
|
|||
expect(
|
|||
dataSummary.hasClass('advanced-tab__transaction-data-summary'),
|
|||
).toStrictEqual(true);
|
|||
});
|
|||
|
|||
it('should render titles of the data', () => {
|
|||
const titlesNode = dataSummary.children().at(0);
|
|||
expect(
|
|||
|
titlesNode.hasClass('advanced-tab__transaction-data-summary__titles'),
|
||
).toStrictEqual(true);
|
|||
expect(titlesNode.children().at(0).text()).toStrictEqual(
|
|||
|
'newTransactionFee',
|
||
);
|
|||
});
|
|||
|
|||
it('should render the data', () => {
|
|||
const dataNode = dataSummary.children().at(1);
|
|||
expect(
|
|||
|
dataNode.hasClass('advanced-tab__transaction-data-summary__container'),
|
||
).toStrictEqual(true);
|
|||
expect(dataNode.children().at(0).text()).toStrictEqual('mockTotalFee');
|
|||
});
|
|||
});
|
|||
});
|