mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Unit test proptype (#14868)
* Add missing props to advanced tab component test. * Add icon size prop to site icon test * Add hardwareWalletRequiresConnection prop to signature request test as a boolean * Add setShowDetectedTokens prop to detect token test * Set Setting description prop to be either object or string.
This commit is contained in:
parent
ae76c365a0
commit
18e4af7690
@ -8,7 +8,11 @@ import DetectedToken from './detected-token';
|
||||
describe('DetectedToken', () => {
|
||||
it('should render the detected token found page', async () => {
|
||||
const store = configureStore(testData);
|
||||
renderWithProvider(<DetectedToken />, store);
|
||||
const props = {
|
||||
setShowDetectedTokens: jest.fn(),
|
||||
};
|
||||
|
||||
renderWithProvider(<DetectedToken {...props} />, store);
|
||||
|
||||
expect(screen.getByText('0 LINK')).toBeInTheDocument();
|
||||
expect(screen.getByText('0 COMP')).toBeInTheDocument();
|
||||
|
@ -66,7 +66,7 @@ describe('Signature Request Component', () => {
|
||||
};
|
||||
const wrapper = shallowWithContext(
|
||||
<SignatureRequest
|
||||
hardwareWalletRequiresConnection={() => false}
|
||||
hardwareWalletRequiresConnection={false}
|
||||
clearConfirmTransaction={() => undefined}
|
||||
cancel={() => undefined}
|
||||
sign={() => undefined}
|
||||
@ -105,7 +105,7 @@ describe('Signature Request Component', () => {
|
||||
};
|
||||
const wrapper = shallowWithContext(
|
||||
<SignatureRequest
|
||||
hardwareWalletRequiresConnection={() => false}
|
||||
hardwareWalletRequiresConnection={false}
|
||||
clearConfirmTransaction={() => undefined}
|
||||
cancel={() => undefined}
|
||||
sign={() => undefined}
|
||||
|
@ -32,6 +32,7 @@ describe('Signature Request', () => {
|
||||
history: {
|
||||
push: sinon.spy(),
|
||||
},
|
||||
hardwareWalletRequiresConnection: false,
|
||||
clearConfirmTransaction: sinon.spy(),
|
||||
cancelMessage: sinon.spy(),
|
||||
cancel: sinon.stub().resolves(),
|
||||
|
@ -4,6 +4,7 @@ import SiteIcon from '.';
|
||||
|
||||
describe('SiteIcon', () => {
|
||||
const args = {
|
||||
size: 32,
|
||||
name: 'Snap name',
|
||||
icon: './images/eth_logo.svg',
|
||||
className: 'classname-test',
|
||||
@ -11,7 +12,7 @@ describe('SiteIcon', () => {
|
||||
};
|
||||
|
||||
it('should render without crashing', () => {
|
||||
const { getByText } = render(<SiteIcon name={args.name} />);
|
||||
const { getByText } = render(<SiteIcon size={32} name={args.name} />);
|
||||
expect(getByText('S')).toBeDefined();
|
||||
});
|
||||
|
||||
|
@ -29,5 +29,5 @@ Setting.propTypes = {
|
||||
value: PropTypes.bool,
|
||||
setValue: PropTypes.func,
|
||||
title: PropTypes.string,
|
||||
description: PropTypes.string,
|
||||
description: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ describe('AdvancedTab Component', () => {
|
||||
dismissSeedBackUpReminder={false}
|
||||
useTokenDetection
|
||||
setUseTokenDetection={toggleTokenDetection}
|
||||
userHasALedgerAccount
|
||||
/>,
|
||||
{
|
||||
context: {
|
||||
@ -59,6 +60,9 @@ describe('AdvancedTab Component', () => {
|
||||
setDismissSeedBackUpReminder={() => undefined}
|
||||
dismissSeedBackUpReminder={false}
|
||||
setShowTestNetworks={toggleTestnet}
|
||||
useTokenDetection
|
||||
setUseTokenDetection={toggleTokenDetection}
|
||||
userHasALedgerAccount
|
||||
/>,
|
||||
{
|
||||
context: {
|
||||
@ -103,6 +107,7 @@ describe('AdvancedTab Component', () => {
|
||||
dismissSeedBackUpReminder={false}
|
||||
useTokenDetection
|
||||
setUseTokenDetection={toggleTokenDetection}
|
||||
userHasALedgerAccount
|
||||
/>,
|
||||
{
|
||||
context: {
|
||||
@ -139,6 +144,7 @@ describe('AdvancedTab Component', () => {
|
||||
dismissSeedBackUpReminder={false}
|
||||
useTokenDetection
|
||||
setUseTokenDetection={toggleTokenDetection}
|
||||
userHasALedgerAccount
|
||||
/>,
|
||||
{
|
||||
context: {
|
||||
|
Loading…
Reference in New Issue
Block a user