Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test proptype #14868

Merged
merged 5 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ui/components/app/detected-token/detected-token.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Signature Request Component', () => {
};
const wrapper = shallowWithContext(
<SignatureRequest
hardwareWalletRequiresConnection={() => false}
hardwareWalletRequiresConnection={false}
clearConfirmTransaction={() => undefined}
cancel={() => undefined}
sign={() => undefined}
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('Signature Request Component', () => {
};
const wrapper = shallowWithContext(
<SignatureRequest
hardwareWalletRequiresConnection={() => false}
hardwareWalletRequiresConnection={false}
clearConfirmTransaction={() => undefined}
cancel={() => undefined}
sign={() => undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Signature Request', () => {
history: {
push: sinon.spy(),
},
hardwareWalletRequiresConnection: false,
clearConfirmTransaction: sinon.spy(),
cancelMessage: sinon.spy(),
cancel: sinon.stub().resolves(),
Expand Down
3 changes: 2 additions & 1 deletion ui/components/ui/site-icon/site-icon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import SiteIcon from '.';

describe('SiteIcon', () => {
const args = {
size: 32,
name: 'Snap name',
icon: './images/eth_logo.svg',
className: 'classname-test',
fallbackClassName: 'fallback-classname-test',
};

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();
});

Expand Down
2 changes: 1 addition & 1 deletion ui/pages/onboarding-flow/privacy-settings/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('AdvancedTab Component', () => {
dismissSeedBackUpReminder={false}
useTokenDetection
setUseTokenDetection={toggleTokenDetection}
userHasALedgerAccount
/>,
{
context: {
Expand Down Expand Up @@ -59,6 +60,9 @@ describe('AdvancedTab Component', () => {
setDismissSeedBackUpReminder={() => undefined}
dismissSeedBackUpReminder={false}
setShowTestNetworks={toggleTestnet}
useTokenDetection
setUseTokenDetection={toggleTokenDetection}
userHasALedgerAccount
/>,
{
context: {
Expand Down Expand Up @@ -103,6 +107,7 @@ describe('AdvancedTab Component', () => {
dismissSeedBackUpReminder={false}
useTokenDetection
setUseTokenDetection={toggleTokenDetection}
userHasALedgerAccount
/>,
{
context: {
Expand Down Expand Up @@ -139,6 +144,7 @@ describe('AdvancedTab Component', () => {
dismissSeedBackUpReminder={false}
useTokenDetection
setUseTokenDetection={toggleTokenDetection}
userHasALedgerAccount
/>,
{
context: {
Expand Down