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:
119693fe05
develop
feature/default_network_editable
v10.22.3
${ noResults }
60 lines
1.9 KiB
60 lines
1.9 KiB
import React from 'react';
|
|||
import { shallow } from 'enzyme';
|
|||
import sinon from 'sinon';
|
|||
import UserPreferencedCurrencyDisplay from '../../../../../components/app/user-preferenced-currency-display';
|
|||
import GasFeeDisplay from './gas-fee-display.component';
|
|||
|
|
||
const propsMethodSpies = {
|
|||
showCustomizeGasModal: sinon.spy(),
|
|||
onReset: sinon.spy(),
|
|||
};
|
|||
|
|
||
describe('GasFeeDisplay Component', () => {
|
|||
let wrapper;
|
|||
|
|
||
describe('render', () => {
|
|||
beforeEach(() => {
|
|||
|
wrapper = shallow(
|
||
<GasFeeDisplay
|
|||
conversionRate={20}
|
|||
gasTotal="mockGasTotal"
|
|||
primaryCurrency="mockPrimaryCurrency"
|
|||
convertedCurrency="mockConvertedCurrency"
|
|||
showGasButtonGroup={propsMethodSpies.showCustomizeGasModal}
|
|||
onReset={propsMethodSpies.onReset}
|
|||
|
/>,
|
||
{ context: { t: (str) => `${str}_t` } },
|
|||
);
|
|||
});
|
|||
|
|
||
afterEach(() => {
|
|||
propsMethodSpies.showCustomizeGasModal.resetHistory();
|
|||
});
|
|||
|
|
||
it('should render a CurrencyDisplay component', () => {
|
|||
expect(wrapper.find(UserPreferencedCurrencyDisplay)).toHaveLength(2);
|
|||
});
|
|||
|
|
||
it('should render the CurrencyDisplay with the correct props', () => {
|
|||
|
const { type, value } = wrapper
|
||
.find(UserPreferencedCurrencyDisplay)
|
|||
.at(0)
|
|||
.props();
|
|||
expect(type).toStrictEqual('PRIMARY');
|
|||
expect(value).toStrictEqual('mockGasTotal');
|
|||
});
|
|||
|
|
||
it('should render the reset button with the correct props', () => {
|
|||
const { onClick, className } = wrapper.find('button').props();
|
|||
expect(className).toStrictEqual('gas-fee-reset');
|
|||
expect(propsMethodSpies.onReset.callCount).toStrictEqual(0);
|
|||
onClick();
|
|||
expect(propsMethodSpies.onReset.callCount).toStrictEqual(1);
|
|||
});
|
|||
|
|||
it('should render the reset button with the correct text', () => {
|
|||
expect(wrapper.find('button').text()).toStrictEqual('reset_t');
|
|||
});
|
|||
});
|
|||
});
|