From 42fd8b0ff0fb3a395c8cca3d53981ddb74fa116e Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 3 Dec 2020 09:46:22 -0600 Subject: [PATCH] Use strict equality in unit tests (#9966) --- .../tests/account-list-item-component.test.js | 37 ++-- .../account-menu/tests/account-menu.test.js | 36 ++-- .../tests/unconnected-account-alert.test.js | 13 +- .../app/app-header/tests/app-header.test.js | 4 +- .../confirm-detail-row.component.test.js | 14 +- .../app/dropdowns/tests/dropdown.test.js | 8 +- .../tests/network-dropdown-icon.test.js | 8 +- .../dropdowns/tests/network-dropdown.test.js | 20 +-- .../advanced-gas-input-component.test.js | 28 +-- .../advanced-tab-content-component.test.js | 11 +- .../tests/basic-tab-content-component.test.js | 20 +-- ...gas-modal-page-container-component.test.js | 68 +++++--- .../app/info-box/tests/info-box.test.js | 4 +- .../tests/modal-content.component.test.js | 26 +-- .../app/modal/tests/modal.component.test.js | 52 +++--- ...ncel-transaction-gas-fee.component.test.js | 10 +- .../cancel-transaction.component.test.js | 28 +-- .../tests/confirm-delete-network.test.js | 2 +- .../tests/confirm-remove-account.test.js | 5 +- .../tests/metametrics-opt-in-modal.test.js | 10 +- .../tests/account-details-modal.test.js | 4 +- .../tests/selected-account-component.test.js | 7 +- .../sidebars/tests/sidebars-component.test.js | 14 +- .../tests/signature-request.test.js | 2 +- .../app/token-cell/token-cell.test.js | 22 ++- ...transaction-activity-log.component.test.js | 4 +- ...transaction-activity-log.container.test.js | 2 +- .../transaction-activity-log.util.test.js | 11 +- ...ransaction-breakdown-row.component.test.js | 6 +- ...action-list-item-details.component.test.js | 10 +- .../transaction-status.component.test.js | 12 +- ...erenced-currency-display.component.test.js | 10 +- ...eferenced-currency-input.component.test.js | 8 +- ...eferenced-currency-input.container.test.js | 2 +- ...-preferenced-token-input.component.test.js | 8 +- ...-preferenced-token-input.container.test.js | 2 +- ...cccount-mismatch-warning.component.test.js | 4 +- .../components/ui/alert/tests/alert.test.js | 6 +- .../tests/breadcrumbs.component.test.js | 10 +- .../tests/button-group-component.test.js | 41 ++--- .../ui/card/tests/card.component.test.js | 4 +- .../tests/currency-display.component.test.js | 4 +- .../tests/currency-input.component.test.js | 136 ++++++++------- .../tests/currency-input.container.test.js | 4 +- .../tests/error-message.component.test.js | 12 +- .../tests/hex-to-decimal.component.test.js | 4 +- .../tests/identicon.component.test.js | 8 +- .../ui/list-item/tests/list-item.test.js | 14 +- .../tests/metafox-logo.component.test.js | 12 +- .../page-container-footer.component.test.js | 23 +-- .../page-container-header.component.test.js | 31 ++-- .../tests/token-input.component.test.js | 111 ++++++------ .../tests/unit-input.component.test.js | 34 ++-- .../confirm-transaction.duck.test.js | 83 +++++---- ui/app/ducks/gas/gas-duck.test.js | 60 +++---- ui/app/ducks/send/send-duck.test.js | 30 ++-- .../tests/with-modal-props.test.js | 12 +- ui/app/helpers/utils/common.util.test.js | 2 +- ui/app/helpers/utils/confirm-tx.util.test.js | 34 ++-- ui/app/helpers/utils/conversion-util.test.js | 58 +++---- ui/app/helpers/utils/conversions.util.test.js | 12 +- ui/app/helpers/utils/fetch-with-cache.test.js | 6 +- ui/app/helpers/utils/i18n-helper.test.js | 18 +- .../helpers/utils/transactions.util.test.js | 10 +- ui/app/helpers/utils/util.test.js | 57 ++++--- .../hooks/tests/useCancelTransaction.test.js | 12 +- ui/app/hooks/tests/useCurrencyDisplay.test.js | 6 +- .../hooks/tests/useRetryTransaction.test.js | 4 +- ui/app/hooks/tests/useTokenData.test.js | 6 +- .../hooks/tests/useTokenDisplayValue.test.js | 2 +- .../tests/useTransactionDisplayData.test.js | 24 ++- .../tests/useUserPreferencedCurrency.test.js | 4 +- .../pages/add-token/tests/add-token.test.js | 15 +- ...confirm-transaction-base.component.test.js | 10 +- .../tests/create-account.test.js | 12 +- .../import-with-seed-phrase.component.test.js | 21 ++- .../end-of-flow/tests/end-of-flow.test.js | 2 +- .../tests/first-time-flow-switch.test.js | 14 +- .../tests/reveal-seed-phrase.test.js | 10 +- .../confirm-seed-phrase-component.test.js | 20 +-- .../select-action/tests/select-action.test.js | 4 +- .../welcome/tests/welcome.test.js | 4 +- ui/app/pages/lock/tests/lock.test.js | 4 +- .../tests/add-recipient-component.test.js | 47 +++--- .../tests/add-recipient-container.test.js | 4 +- .../tests/add-recipient-utils.test.js | 16 +- .../tests/amount-max-button-component.test.js | 20 ++- .../tests/amount-max-button-container.test.js | 18 +- .../tests/amount-max-button-utils.test.js | 4 +- .../tests/send-amount-row-component.test.js | 30 ++-- .../tests/send-amount-row-container.test.js | 29 ++-- .../tests/gas-fee-display.component.test.js | 14 +- .../tests/send-gas-row-component.test.js | 34 ++-- .../send-row-error-message-component.test.js | 8 +- .../send-row-error-message-container.test.js | 2 +- .../tests/send-row-wrapper-component.test.js | 20 +-- .../tests/send-content-component.test.js | 14 +- .../tests/send-footer-component.test.js | 44 ++--- .../tests/send-footer-container.test.js | 79 +++++---- .../tests/send-footer-utils.test.js | 16 +- .../tests/send-header-component.test.js | 18 +- .../pages/send/tests/send-component.test.js | 113 +++++++------ .../pages/send/tests/send-container.test.js | 13 +- ui/app/pages/send/tests/send-utils.test.js | 159 ++++++++++-------- .../tests/advanced-tab-component.test.js | 6 +- .../security-tab/tests/security-tab.test.js | 2 +- ui/app/pages/swaps/swaps.util.test.js | 24 +-- .../unlock-page/tests/unlock-page.test.js | 6 +- .../tests/confirm-transaction.test.js | 8 +- ui/app/selectors/tests/custom-gas.test.js | 12 +- ui/app/selectors/tests/permissions.test.js | 69 ++++---- ui/app/selectors/tests/selectors.test.js | 40 +++-- ui/app/selectors/tests/send.test.js | 83 ++++----- ui/app/selectors/tests/transactions.test.js | 19 ++- 114 files changed, 1359 insertions(+), 1154 deletions(-) diff --git a/ui/app/components/app/account-list-item/tests/account-list-item-component.test.js b/ui/app/components/app/account-list-item/tests/account-list-item-component.test.js index 4c65e3b70..5b329d1ac 100644 --- a/ui/app/components/app/account-list-item/tests/account-list-item-component.test.js +++ b/ui/app/components/app/account-list-item/tests/account-list-item-component.test.js @@ -45,23 +45,23 @@ describe('AccountListItem Component', function () { }) it('should render a div with the passed className', function () { - assert.equal(wrapper.find('.mockClassName').length, 1) + assert.strictEqual(wrapper.find('.mockClassName').length, 1) assert(wrapper.find('.mockClassName').is('div')) assert(wrapper.find('.mockClassName').hasClass('account-list-item')) }) it('should call handleClick with the expected props when the root div is clicked', function () { const { onClick } = wrapper.find('.mockClassName').props() - assert.equal(propsMethodSpies.handleClick.callCount, 0) + assert.strictEqual(propsMethodSpies.handleClick.callCount, 0) onClick() - assert.equal(propsMethodSpies.handleClick.callCount, 1) - assert.deepEqual(propsMethodSpies.handleClick.getCall(0).args, [ + assert.strictEqual(propsMethodSpies.handleClick.callCount, 1) + assert.deepStrictEqual(propsMethodSpies.handleClick.getCall(0).args, [ { address: 'mockAddress', name: 'mockName', balance: 'mockBalance' }, ]) }) it('should have a top row div', function () { - assert.equal( + assert.strictEqual( wrapper.find('.mockClassName > .account-list-item__top-row').length, 1, ) @@ -74,16 +74,19 @@ describe('AccountListItem Component', function () { const topRow = wrapper.find( '.mockClassName > .account-list-item__top-row', ) - assert.equal(topRow.find(Identicon).length, 1) - assert.equal(topRow.find('.account-list-item__account-name').length, 1) - assert.equal(topRow.find('.account-list-item__icon').length, 1) + assert.strictEqual(topRow.find(Identicon).length, 1) + assert.strictEqual( + topRow.find('.account-list-item__account-name').length, + 1, + ) + assert.strictEqual(topRow.find('.account-list-item__icon').length, 1) }) it('should show the account name if it exists', function () { const topRow = wrapper.find( '.mockClassName > .account-list-item__top-row', ) - assert.equal( + assert.strictEqual( topRow.find('.account-list-item__account-name').text(), 'mockName', ) @@ -94,7 +97,7 @@ describe('AccountListItem Component', function () { const topRow = wrapper.find( '.mockClassName > .account-list-item__top-row', ) - assert.equal( + assert.strictEqual( topRow.find('.account-list-item__account-name').text(), 'addressButNoName', ) @@ -115,25 +118,27 @@ describe('AccountListItem Component', function () { const topRow = wrapper.find( '.mockClassName > .account-list-item__top-row', ) - assert.equal(topRow.find('.account-list-item__icon').length, 0) + assert.strictEqual(topRow.find('.account-list-item__icon').length, 0) }) it('should render the account address as a checksumAddress if displayAddress is true and name is provided', function () { wrapper.setProps({ displayAddress: true }) - assert.equal( + assert.strictEqual( wrapper.find('.account-list-item__account-address').length, 1, ) - assert.equal( + assert.strictEqual( wrapper.find('.account-list-item__account-address').text(), 'mockCheckSumAddress', ) - assert.deepEqual(checksumAddressStub.getCall(0).args, ['mockAddress']) + assert.deepStrictEqual(checksumAddressStub.getCall(0).args, [ + 'mockAddress', + ]) }) it('should not render the account address as a checksumAddress if displayAddress is false', function () { wrapper.setProps({ displayAddress: false }) - assert.equal( + assert.strictEqual( wrapper.find('.account-list-item__account-address').length, 0, ) @@ -141,7 +146,7 @@ describe('AccountListItem Component', function () { it('should not render the account address as a checksumAddress if name is not provided', function () { wrapper.setProps({ account: { address: 'someAddressButNoName' } }) - assert.equal( + assert.strictEqual( wrapper.find('.account-list-item__account-address').length, 0, ) diff --git a/ui/app/components/app/account-menu/tests/account-menu.test.js b/ui/app/components/app/account-menu/tests/account-menu.test.js index 70dba281f..eb35b1c3b 100644 --- a/ui/app/components/app/account-menu/tests/account-menu.test.js +++ b/ui/app/components/app/account-menu/tests/account-menu.test.js @@ -74,14 +74,14 @@ describe('Account Menu', function () { describe('Render Content', function () { it('returns account name from identities', function () { const accountName = wrapper.find('.account-menu__name') - assert.equal(accountName.length, 2) + assert.strictEqual(accountName.length, 2) }) it('renders user preference currency display balance from account balance', function () { const accountBalance = wrapper.find( '.currency-display-component.account-menu__balance', ) - assert.equal(accountBalance.length, 2) + assert.strictEqual(accountBalance.length, 2) }) it('simulate click', function () { @@ -91,12 +91,15 @@ describe('Account Menu', function () { click.first().simulate('click') assert(props.showAccountDetail.calledOnce) - assert.equal(props.showAccountDetail.getCall(0).args[0], '0xAddress') + assert.strictEqual( + props.showAccountDetail.getCall(0).args[0], + '0xAddress', + ) }) it('render imported account label', function () { const importedAccount = wrapper.find('.keyring-label.allcaps') - assert.equal(importedAccount.text(), 'imported') + assert.strictEqual(importedAccount.text(), 'imported') }) }) @@ -105,13 +108,13 @@ describe('Account Menu', function () { it('logout', function () { logout = wrapper.find('.account-menu__lock-button') - assert.equal(logout.length, 1) + assert.strictEqual(logout.length, 1) }) it('simulate click', function () { logout.simulate('click') assert(props.lockMetamask.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/') + assert.strictEqual(props.history.push.getCall(0).args[0], '/') }) }) @@ -120,13 +123,13 @@ describe('Account Menu', function () { it('renders create account item', function () { createAccount = wrapper.find({ text: 'createAccount' }) - assert.equal(createAccount.length, 1) + assert.strictEqual(createAccount.length, 1) }) it('calls toggle menu and push new-account route to history', function () { createAccount.simulate('click') assert(props.toggleAccountMenu.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/new-account') + assert.strictEqual(props.history.push.getCall(0).args[0], '/new-account') }) }) @@ -135,7 +138,7 @@ describe('Account Menu', function () { it('renders import account item', function () { importAccount = wrapper.find({ text: 'importAccount' }) - assert.equal(importAccount.length, 1) + assert.strictEqual(importAccount.length, 1) }) it('calls toggle menu and push /new-account/import route to history', function () { @@ -150,13 +153,13 @@ describe('Account Menu', function () { it('renders import account item', function () { connectHardwareWallet = wrapper.find({ text: 'connectHardwareWallet' }) - assert.equal(connectHardwareWallet.length, 1) + assert.strictEqual(connectHardwareWallet.length, 1) }) it('calls toggle menu and push /new-account/connect route to history', function () { connectHardwareWallet.simulate('click') assert(props.toggleAccountMenu.calledOnce) - assert.equal( + assert.strictEqual( props.history.push.getCall(0).args[0], '/new-account/connect', ) @@ -168,13 +171,16 @@ describe('Account Menu', function () { it('renders import account item', function () { infoHelp = wrapper.find({ text: 'infoHelp' }) - assert.equal(infoHelp.length, 1) + assert.strictEqual(infoHelp.length, 1) }) it('calls toggle menu and push /new-account/connect route to history', function () { infoHelp.simulate('click') assert(props.toggleAccountMenu.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/settings/about-us') + assert.strictEqual( + props.history.push.getCall(0).args[0], + '/settings/about-us', + ) }) }) @@ -183,13 +189,13 @@ describe('Account Menu', function () { it('renders import account item', function () { settings = wrapper.find({ text: 'settings' }) - assert.equal(settings.length, 1) + assert.strictEqual(settings.length, 1) }) it('calls toggle menu and push /new-account/connect route to history', function () { settings.simulate('click') assert(props.toggleAccountMenu.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/settings') + assert.strictEqual(props.history.push.getCall(0).args[0], '/settings') }) }) }) diff --git a/ui/app/components/app/alerts/unconnected-account-alert/tests/unconnected-account-alert.test.js b/ui/app/components/app/alerts/unconnected-account-alert/tests/unconnected-account-alert.test.js index fff6504bb..d16ec36c0 100644 --- a/ui/app/components/app/alerts/unconnected-account-alert/tests/unconnected-account-alert.test.js +++ b/ui/app/components/app/alerts/unconnected-account-alert/tests/unconnected-account-alert.test.js @@ -115,9 +115,9 @@ describe('Unconnected Account Alert', function () { const dontShowCheckbox = getByRole('checkbox') - assert.equal(dontShowCheckbox.checked, false) + assert.strictEqual(dontShowCheckbox.checked, false) fireEvent.click(dontShowCheckbox) - assert.equal(dontShowCheckbox.checked, true) + assert.strictEqual(dontShowCheckbox.checked, true) }) it('clicks dismiss button and calls dismissAlert action', function () { @@ -128,7 +128,10 @@ describe('Unconnected Account Alert', function () { const dismissButton = getByText(/dismiss/u) fireEvent.click(dismissButton) - assert.equal(store.getActions()[0].type, 'unconnectedAccount/dismissAlert') + assert.strictEqual( + store.getActions()[0].type, + 'unconnectedAccount/dismissAlert', + ) }) it('clicks Dont Show checkbox and dismiss to call disable alert request action', async function () { @@ -148,11 +151,11 @@ describe('Unconnected Account Alert', function () { fireEvent.click(dismissButton) setImmediate(() => { - assert.equal( + assert.strictEqual( store.getActions()[0].type, 'unconnectedAccount/disableAlertRequested', ) - assert.equal( + assert.strictEqual( store.getActions()[1].type, 'unconnectedAccount/disableAlertSucceeded', ) diff --git a/ui/app/components/app/app-header/tests/app-header.test.js b/ui/app/components/app/app-header/tests/app-header.test.js index 0bb9ed9df..7a1b43ee7 100644 --- a/ui/app/components/app/app-header/tests/app-header.test.js +++ b/ui/app/components/app/app-header/tests/app-header.test.js @@ -43,7 +43,7 @@ describe('App Header', function () { const appLogo = wrapper.find(MetaFoxLogo) appLogo.simulate('click') assert(props.history.push.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/') + assert.strictEqual(props.history.push.getCall(0).args[0], '/') }) }) @@ -74,7 +74,7 @@ describe('App Header', function () { it('hides network indicator', function () { wrapper.setProps({ hideNetworkIndicator: true }) const network = wrapper.find({ network: 'test' }) - assert.equal(network.length, 0) + assert.strictEqual(network.length, 0) }) }) diff --git a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js index add78407c..ed6ac21f8 100644 --- a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js +++ b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js @@ -29,11 +29,11 @@ describe('Confirm Detail Row Component', function () { }) it('should render a div with a confirm-detail-row class', function () { - assert.equal(wrapper.find('div.confirm-detail-row').length, 1) + assert.strictEqual(wrapper.find('div.confirm-detail-row').length, 1) }) it('should render the label as a child of the confirm-detail-row__label', function () { - assert.equal( + assert.strictEqual( wrapper .find('.confirm-detail-row > .confirm-detail-row__label') .childAt(0) @@ -43,7 +43,7 @@ describe('Confirm Detail Row Component', function () { }) it('should render the headerText as a child of the confirm-detail-row__header-text', function () { - assert.equal( + assert.strictEqual( wrapper .find( '.confirm-detail-row__details > .confirm-detail-row__header-text', @@ -55,7 +55,7 @@ describe('Confirm Detail Row Component', function () { }) it('should render the primaryText as a child of the confirm-detail-row__primary', function () { - assert.equal( + assert.strictEqual( wrapper .find('.confirm-detail-row__details > .confirm-detail-row__primary') .childAt(0) @@ -65,7 +65,7 @@ describe('Confirm Detail Row Component', function () { }) it('should render the ethText as a child of the confirm-detail-row__secondary', function () { - assert.equal( + assert.strictEqual( wrapper .find('.confirm-detail-row__details > .confirm-detail-row__secondary') .childAt(0) @@ -75,14 +75,14 @@ describe('Confirm Detail Row Component', function () { }) it('should set the fiatTextColor on confirm-detail-row__primary', function () { - assert.equal( + assert.strictEqual( wrapper.find('.confirm-detail-row__primary').props().style.color, 'mockColor', ) }) it('should assure the confirm-detail-row__header-text classname is correct', function () { - assert.equal( + assert.strictEqual( wrapper.find('.confirm-detail-row__header-text').props().className, 'confirm-detail-row__header-text mockHeaderClass', ) diff --git a/ui/app/components/app/dropdowns/tests/dropdown.test.js b/ui/app/components/app/dropdowns/tests/dropdown.test.js index e362104ba..7ceb8227c 100644 --- a/ui/app/components/app/dropdowns/tests/dropdown.test.js +++ b/ui/app/components/app/dropdowns/tests/dropdown.test.js @@ -20,16 +20,16 @@ describe('Dropdown', function () { }) it('renders li with dropdown-menu-item class', function () { - assert.equal(wrapper.find('li.dropdown-menu-item').length, 1) + assert.strictEqual(wrapper.find('li.dropdown-menu-item').length, 1) }) it('adds style based on props passed', function () { - assert.equal(wrapper.prop('style').test, 'style') + assert.strictEqual(wrapper.prop('style').test, 'style') }) it('simulates click event and calls onClick and closeMenu', function () { wrapper.prop('onClick')() - assert.equal(onClickSpy.callCount, 1) - assert.equal(closeMenuSpy.callCount, 1) + assert.strictEqual(onClickSpy.callCount, 1) + assert.strictEqual(closeMenuSpy.callCount, 1) }) }) diff --git a/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js b/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js index f0370b148..01210b49d 100644 --- a/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js +++ b/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js @@ -14,9 +14,9 @@ describe('Network Dropdown Icon', function () { />, ) const styleProp = wrapper.find('.menu-icon-circle').children().prop('style') - assert.equal(styleProp.background, 'red') - assert.equal(styleProp.border, 'none') - assert.equal(styleProp.height, '12px') - assert.equal(styleProp.width, '12px') + assert.strictEqual(styleProp.background, 'red') + assert.strictEqual(styleProp.border, 'none') + assert.strictEqual(styleProp.height, '12px') + assert.strictEqual(styleProp.width, '12px') }) }) diff --git a/ui/app/components/app/dropdowns/tests/network-dropdown.test.js b/ui/app/components/app/dropdowns/tests/network-dropdown.test.js index 09bec2615..2df87f956 100644 --- a/ui/app/components/app/dropdowns/tests/network-dropdown.test.js +++ b/ui/app/components/app/dropdowns/tests/network-dropdown.test.js @@ -31,11 +31,11 @@ describe('Network Dropdown', function () { }) it('checks for network droppo class', function () { - assert.equal(wrapper.find('.network-droppo').length, 1) + assert.strictEqual(wrapper.find('.network-droppo').length, 1) }) it('renders only one child when networkDropdown is false in state', function () { - assert.equal(wrapper.children().length, 1) + assert.strictEqual(wrapper.children().length, 1) }) }) @@ -62,53 +62,53 @@ describe('Network Dropdown', function () { }) it('renders 8 DropDownMenuItems ', function () { - assert.equal(wrapper.find(DropdownMenuItem).length, 8) + assert.strictEqual(wrapper.find(DropdownMenuItem).length, 8) }) it('checks background color for first NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(0).prop('backgroundColor'), '#29B6AF', ) // Ethereum Mainnet Teal }) it('checks background color for second NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(1).prop('backgroundColor'), '#ff4a8d', ) // Ropsten Red }) it('checks background color for third NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(2).prop('backgroundColor'), '#7057ff', ) // Kovan Purple }) it('checks background color for fourth NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(3).prop('backgroundColor'), '#f6c343', ) // Rinkeby Yellow }) it('checks background color for fifth NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(4).prop('backgroundColor'), '#3099f2', ) // Goerli Blue }) it('checks background color for sixth NetworkDropdownIcon', function () { - assert.equal( + assert.strictEqual( wrapper.find(NetworkDropdownIcon).at(5).prop('backgroundColor'), '#d6d9dc', ) // "Custom network grey" }) it('checks dropdown for frequestRPCList from state', function () { - assert.equal( + assert.strictEqual( wrapper.find(DropdownMenuItem).at(6).text(), '✓http://localhost:7545', ) diff --git a/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js b/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js index 161237c90..8c17f4d52 100644 --- a/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js +++ b/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js @@ -40,7 +40,7 @@ describe('Advanced Gas Inputs', function () { wrapper.find('input').at(0).simulate('change', event) clock.tick(499) - assert.equal(props.updateCustomGasPrice.callCount, 0) + assert.strictEqual(props.updateCustomGasPrice.callCount, 0) }) it('simulates onChange on gas price after debounce', function () { @@ -49,8 +49,8 @@ describe('Advanced Gas Inputs', function () { wrapper.find('input').at(0).simulate('change', event) clock.tick(500) - assert.equal(props.updateCustomGasPrice.calledOnce, true) - assert.equal(props.updateCustomGasPrice.calledWith(1), true) + assert.strictEqual(props.updateCustomGasPrice.calledOnce, true) + assert.strictEqual(props.updateCustomGasPrice.calledWith(1), true) }) it('wont update gasLimit in props before debounce', function () { @@ -59,7 +59,7 @@ describe('Advanced Gas Inputs', function () { wrapper.find('input').at(1).simulate('change', event) clock.tick(499) - assert.equal(props.updateCustomGasLimit.callCount, 0) + assert.strictEqual(props.updateCustomGasLimit.callCount, 0) }) it('simulates onChange on gas limit after debounce', function () { @@ -68,8 +68,8 @@ describe('Advanced Gas Inputs', function () { wrapper.find('input').at(1).simulate('change', event) clock.tick(500) - assert.equal(props.updateCustomGasLimit.calledOnce, true) - assert.equal(props.updateCustomGasLimit.calledWith(21000), true) + assert.strictEqual(props.updateCustomGasLimit.calledOnce, true) + assert.strictEqual(props.updateCustomGasLimit.calledWith(21000), true) }) it('errors when insufficientBalance under gas price and gas limit', function () { @@ -77,10 +77,10 @@ describe('Advanced Gas Inputs', function () { const renderError = wrapper.find( '.advanced-gas-inputs__gas-edit-row__error-text', ) - assert.equal(renderError.length, 2) + assert.strictEqual(renderError.length, 2) - assert.equal(renderError.at(0).text(), 'insufficientBalance') - assert.equal(renderError.at(1).text(), 'insufficientBalance') + assert.strictEqual(renderError.at(0).text(), 'insufficientBalance') + assert.strictEqual(renderError.at(1).text(), 'insufficientBalance') }) it('errors zero gas price / speed up', function () { @@ -89,10 +89,10 @@ describe('Advanced Gas Inputs', function () { const renderError = wrapper.find( '.advanced-gas-inputs__gas-edit-row__error-text', ) - assert.equal(renderError.length, 2) + assert.strictEqual(renderError.length, 2) - assert.equal(renderError.at(0).text(), 'zeroGasPriceOnSpeedUpError') - assert.equal(renderError.at(1).text(), 'gasLimitTooLowWithDynamicFee') + assert.strictEqual(renderError.at(0).text(), 'zeroGasPriceOnSpeedUpError') + assert.strictEqual(renderError.at(1).text(), 'gasLimitTooLowWithDynamicFee') }) it('warns when custom gas price is too low', function () { @@ -101,8 +101,8 @@ describe('Advanced Gas Inputs', function () { const renderWarning = wrapper.find( '.advanced-gas-inputs__gas-edit-row__warning-text', ) - assert.equal(renderWarning.length, 1) + assert.strictEqual(renderWarning.length, 1) - assert.equal(renderWarning.text(), 'gasPriceExtremelyLow') + assert.strictEqual(renderWarning.text(), 'gasPriceExtremelyLow') }) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js index 0e632a92a..b33dcadee 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js @@ -39,7 +39,7 @@ describe('AdvancedTabContent Component', function () { it('should render the expected child of the advanced-tab div', function () { const advancedTabChildren = wrapper.children() - assert.equal(advancedTabChildren.length, 2) + assert.strictEqual(advancedTabChildren.length, 2) assert( advancedTabChildren @@ -52,7 +52,7 @@ describe('AdvancedTabContent Component', function () { const renderDataSummaryArgs = AdvancedTabContent.prototype.renderDataSummary.getCall( 0, ).args - assert.deepEqual(renderDataSummaryArgs, ['$0.25']) + assert.deepStrictEqual(renderDataSummaryArgs, ['$0.25']) }) }) @@ -74,7 +74,10 @@ describe('AdvancedTabContent Component', function () { assert( titlesNode.hasClass('advanced-tab__transaction-data-summary__titles'), ) - assert.equal(titlesNode.children().at(0).text(), 'newTransactionFee') + assert.strictEqual( + titlesNode.children().at(0).text(), + 'newTransactionFee', + ) }) it('should render the data', function () { @@ -82,7 +85,7 @@ describe('AdvancedTabContent Component', function () { assert( dataNode.hasClass('advanced-tab__transaction-data-summary__container'), ) - assert.equal(dataNode.children().at(0).text(), 'mockTotalFee') + assert.strictEqual(dataNode.children().at(0).text(), 'mockTotalFee') }) }) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js index 2c28fc556..ae0829db0 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js @@ -60,7 +60,7 @@ describe('BasicTabContent Component', function () { }) it('should render a GasPriceButtonGroup compenent', function () { - assert.equal(wrapper.find(GasPriceButtonGroup).length, 1) + assert.strictEqual(wrapper.find(GasPriceButtonGroup).length, 1) }) it('should pass correct props to GasPriceButtonGroup', function () { @@ -72,22 +72,22 @@ describe('BasicTabContent Component', function () { noButtonActiveByDefault, showCheck, } = wrapper.find(GasPriceButtonGroup).props() - assert.equal(wrapper.find(GasPriceButtonGroup).length, 1) - assert.equal( + assert.strictEqual(wrapper.find(GasPriceButtonGroup).length, 1) + assert.strictEqual( buttonDataLoading, mockGasPriceButtonGroupProps.buttonDataLoading, ) - assert.equal(className, mockGasPriceButtonGroupProps.className) - assert.equal( + assert.strictEqual(className, mockGasPriceButtonGroupProps.className) + assert.strictEqual( noButtonActiveByDefault, mockGasPriceButtonGroupProps.noButtonActiveByDefault, ) - assert.equal(showCheck, mockGasPriceButtonGroupProps.showCheck) - assert.deepEqual( + assert.strictEqual(showCheck, mockGasPriceButtonGroupProps.showCheck) + assert.deepStrictEqual( gasButtonInfo, mockGasPriceButtonGroupProps.gasButtonInfo, ) - assert.equal( + assert.strictEqual( JSON.stringify(handleGasPriceSelection), JSON.stringify(mockGasPriceButtonGroupProps.handleGasPriceSelection), ) @@ -101,8 +101,8 @@ describe('BasicTabContent Component', function () { }, }) - assert.equal(wrapper.find(GasPriceButtonGroup).length, 0) - assert.equal(wrapper.find(Loading).length, 1) + assert.strictEqual(wrapper.find(GasPriceButtonGroup).length, 0) + assert.strictEqual(wrapper.find(Loading).length, 1) }) }) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js index 74bd8ee90..8ae08274c 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js @@ -88,31 +88,31 @@ describe('GasModalPageContainer Component', function () { describe('componentDidMount', function () { it('should call props.fetchBasicGasEstimates', function () { propsMethodSpies.fetchBasicGasEstimates.resetHistory() - assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 0) + assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 0) wrapper.instance().componentDidMount() - assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 1) + assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 1) }) }) describe('render', function () { it('should render a PageContainer compenent', function () { - assert.equal(wrapper.find(PageContainer).length, 1) + assert.strictEqual(wrapper.find(PageContainer).length, 1) }) it('should pass correct props to PageContainer', function () { const { title, subtitle, disabled } = wrapper.find(PageContainer).props() - assert.equal(title, 'customGas') - assert.equal(subtitle, 'customGasSubTitle') - assert.equal(disabled, false) + assert.strictEqual(title, 'customGas') + assert.strictEqual(subtitle, 'customGasSubTitle') + assert.strictEqual(disabled, false) }) it('should pass the correct onCancel and onClose methods to PageContainer', function () { const { onCancel, onClose } = wrapper.find(PageContainer).props() - assert.equal(propsMethodSpies.cancelAndClose.callCount, 0) + assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 0) onCancel() - assert.equal(propsMethodSpies.cancelAndClose.callCount, 1) + assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 1) onClose() - assert.equal(propsMethodSpies.cancelAndClose.callCount, 2) + assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 2) }) it('should pass the correct renderTabs property to PageContainer', function () { @@ -127,7 +127,7 @@ describe('GasModalPageContainer Component', function () { const { tabsComponent } = renderTabsWrapperTester .find(PageContainer) .props() - assert.equal(tabsComponent, 'mockTabs') + assert.strictEqual(tabsComponent, 'mockTabs') GasModalPageContainer.prototype.renderTabs.restore() }) }) @@ -148,32 +148,38 @@ describe('GasModalPageContainer Component', function () { it('should render a Tabs component with "Basic" and "Advanced" tabs', function () { const renderTabsResult = wrapper.instance().renderTabs() const renderedTabs = shallow(renderTabsResult) - assert.equal(renderedTabs.props().className, 'tabs') + assert.strictEqual(renderedTabs.props().className, 'tabs') const tabs = renderedTabs.find(Tab) - assert.equal(tabs.length, 2) + assert.strictEqual(tabs.length, 2) - assert.equal(tabs.at(0).props().name, 'basic') - assert.equal(tabs.at(1).props().name, 'advanced') + assert.strictEqual(tabs.at(0).props().name, 'basic') + assert.strictEqual(tabs.at(1).props().name, 'advanced') - assert.equal(tabs.at(0).childAt(0).props().className, 'gas-modal-content') - assert.equal(tabs.at(1).childAt(0).props().className, 'gas-modal-content') + assert.strictEqual( + tabs.at(0).childAt(0).props().className, + 'gas-modal-content', + ) + assert.strictEqual( + tabs.at(1).childAt(0).props().className, + 'gas-modal-content', + ) }) it('should call renderInfoRows with the expected props', function () { - assert.equal(GP.renderInfoRows.callCount, 0) + assert.strictEqual(GP.renderInfoRows.callCount, 0) wrapper.instance().renderTabs() - assert.equal(GP.renderInfoRows.callCount, 2) + assert.strictEqual(GP.renderInfoRows.callCount, 2) - assert.deepEqual(GP.renderInfoRows.getCall(0).args, [ + assert.deepStrictEqual(GP.renderInfoRows.getCall(0).args, [ 'mockNewTotalFiat', 'mockNewTotalEth', 'mockSendAmount', 'mockTransactionFee', ]) - assert.deepEqual(GP.renderInfoRows.getCall(1).args, [ + assert.deepStrictEqual(GP.renderInfoRows.getCall(1).args, [ 'mockNewTotalFiat', 'mockNewTotalEth', 'mockSendAmount', @@ -202,8 +208,8 @@ describe('GasModalPageContainer Component', function () { const renderedTabs = shallow(renderTabsResult) const tabs = renderedTabs.find(Tab) - assert.equal(tabs.length, 1) - assert.equal(tabs.at(0).props().name, 'advanced') + assert.strictEqual(tabs.length, 1) + assert.strictEqual(tabs.at(0).props().name, 'advanced') }) }) @@ -213,7 +219,7 @@ describe('GasModalPageContainer Component', function () { .instance() .renderBasicTabContent(mockGasPriceButtonGroupProps) - assert.deepEqual( + assert.deepStrictEqual( renderBasicTabContentResult.props.gasPriceButtonGroupProps, mockGasPriceButtonGroupProps, ) @@ -237,7 +243,7 @@ describe('GasModalPageContainer Component', function () { assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName)) const renderedInfoRows = renderedInfoRowsContainer.childAt(0).children() - assert.equal(renderedInfoRows.length, 4) + assert.strictEqual(renderedInfoRows.length, 4) assert(renderedInfoRows.at(0).hasClass(`${baseClassName}__send-info`)) assert( renderedInfoRows.at(1).hasClass(`${baseClassName}__transaction-info`), @@ -247,13 +253,19 @@ describe('GasModalPageContainer Component', function () { renderedInfoRows.at(3).hasClass(`${baseClassName}__fiat-total-info`), ) - assert.equal(renderedInfoRows.at(0).text(), 'sendAmount mockSendAmount') - assert.equal( + assert.strictEqual( + renderedInfoRows.at(0).text(), + 'sendAmount mockSendAmount', + ) + assert.strictEqual( renderedInfoRows.at(1).text(), 'transactionFee mockTransactionFee', ) - assert.equal(renderedInfoRows.at(2).text(), 'newTotal mockNewTotalEth') - assert.equal(renderedInfoRows.at(3).text(), 'mockNewTotalFiat') + assert.strictEqual( + renderedInfoRows.at(2).text(), + 'newTotal mockNewTotalEth', + ) + assert.strictEqual(renderedInfoRows.at(3).text(), 'mockNewTotalFiat') }) }) }) diff --git a/ui/app/components/app/info-box/tests/info-box.test.js b/ui/app/components/app/info-box/tests/info-box.test.js index 031ac62f4..82f019e01 100644 --- a/ui/app/components/app/info-box/tests/info-box.test.js +++ b/ui/app/components/app/info-box/tests/info-box.test.js @@ -20,12 +20,12 @@ describe('InfoBox', function () { it('renders title from props', function () { const title = wrapper.find('.info-box__title') - assert.equal(title.text(), props.title) + assert.strictEqual(title.text(), props.title) }) it('renders description from props', function () { const description = wrapper.find('.info-box__description') - assert.equal(description.text(), props.description) + assert.strictEqual(description.text(), props.description) }) it('closes info box', function () { diff --git a/ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js b/ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js index de40a39bd..8056563f6 100644 --- a/ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js +++ b/ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js @@ -7,17 +7,20 @@ describe('ModalContent Component', function () { it('should render a title', function () { const wrapper = shallow() - assert.equal(wrapper.find('.modal-content__title').length, 1) - assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title') - assert.equal(wrapper.find('.modal-content__description').length, 0) + assert.strictEqual(wrapper.find('.modal-content__title').length, 1) + assert.strictEqual( + wrapper.find('.modal-content__title').text(), + 'Modal Title', + ) + assert.strictEqual(wrapper.find('.modal-content__description').length, 0) }) it('should render a description', function () { const wrapper = shallow() - assert.equal(wrapper.find('.modal-content__title').length, 0) - assert.equal(wrapper.find('.modal-content__description').length, 1) - assert.equal( + assert.strictEqual(wrapper.find('.modal-content__title').length, 0) + assert.strictEqual(wrapper.find('.modal-content__description').length, 1) + assert.strictEqual( wrapper.find('.modal-content__description').text(), 'Modal Description', ) @@ -28,10 +31,13 @@ describe('ModalContent Component', function () { , ) - assert.equal(wrapper.find('.modal-content__title').length, 1) - assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title') - assert.equal(wrapper.find('.modal-content__description').length, 1) - assert.equal( + assert.strictEqual(wrapper.find('.modal-content__title').length, 1) + assert.strictEqual( + wrapper.find('.modal-content__title').text(), + 'Modal Title', + ) + assert.strictEqual(wrapper.find('.modal-content__description').length, 1) + assert.strictEqual( wrapper.find('.modal-content__description').text(), 'Modal Description', ) diff --git a/ui/app/components/app/modal/tests/modal.component.test.js b/ui/app/components/app/modal/tests/modal.component.test.js index fe55b61bd..a0ad195ae 100644 --- a/ui/app/components/app/modal/tests/modal.component.test.js +++ b/ui/app/components/app/modal/tests/modal.component.test.js @@ -9,10 +9,10 @@ describe('Modal Component', function () { it('should render a modal with a submit button', function () { const wrapper = shallow() - assert.equal(wrapper.find('.modal-container').length, 1) + assert.strictEqual(wrapper.find('.modal-container').length, 1) const buttons = wrapper.find(Button) - assert.equal(buttons.length, 1) - assert.equal(buttons.at(0).props().type, 'secondary') + assert.strictEqual(buttons.length, 1) + assert.strictEqual(buttons.at(0).props().type, 'secondary') }) it('should render a modal with a cancel and a submit button', function () { @@ -28,21 +28,21 @@ describe('Modal Component', function () { ) const buttons = wrapper.find(Button) - assert.equal(buttons.length, 2) + assert.strictEqual(buttons.length, 2) const cancelButton = buttons.at(0) const submitButton = buttons.at(1) - assert.equal(cancelButton.props().type, 'default') - assert.equal(cancelButton.props().children, 'Cancel') - assert.equal(handleCancel.callCount, 0) + assert.strictEqual(cancelButton.props().type, 'default') + assert.strictEqual(cancelButton.props().children, 'Cancel') + assert.strictEqual(handleCancel.callCount, 0) cancelButton.simulate('click') - assert.equal(handleCancel.callCount, 1) + assert.strictEqual(handleCancel.callCount, 1) - assert.equal(submitButton.props().type, 'secondary') - assert.equal(submitButton.props().children, 'Submit') - assert.equal(handleSubmit.callCount, 0) + assert.strictEqual(submitButton.props().type, 'secondary') + assert.strictEqual(submitButton.props().children, 'Submit') + assert.strictEqual(handleSubmit.callCount, 0) submitButton.simulate('click') - assert.equal(handleSubmit.callCount, 1) + assert.strictEqual(handleSubmit.callCount, 1) }) it('should render a modal with different button types', function () { @@ -58,9 +58,9 @@ describe('Modal Component', function () { ) const buttons = wrapper.find(Button) - assert.equal(buttons.length, 2) - assert.equal(buttons.at(0).props().type, 'secondary') - assert.equal(buttons.at(1).props().type, 'confirm') + assert.strictEqual(buttons.length, 2) + assert.strictEqual(buttons.at(0).props().type, 'secondary') + assert.strictEqual(buttons.at(1).props().type, 'confirm') }) it('should render a modal with children', function () { @@ -93,15 +93,15 @@ describe('Modal Component', function () { ) assert.ok(wrapper.find('.modal-container__header')) - assert.equal( + assert.strictEqual( wrapper.find('.modal-container__header-text').text(), 'My Header', ) - assert.equal(handleCancel.callCount, 0) - assert.equal(handleSubmit.callCount, 0) + assert.strictEqual(handleCancel.callCount, 0) + assert.strictEqual(handleSubmit.callCount, 0) wrapper.find('.modal-container__header-close').simulate('click') - assert.equal(handleCancel.callCount, 1) - assert.equal(handleSubmit.callCount, 0) + assert.strictEqual(handleCancel.callCount, 1) + assert.strictEqual(handleSubmit.callCount, 0) }) it('should disable the submit button if submitDisabled is true', function () { @@ -120,17 +120,17 @@ describe('Modal Component', function () { ) const buttons = wrapper.find(Button) - assert.equal(buttons.length, 2) + assert.strictEqual(buttons.length, 2) const cancelButton = buttons.at(0) const submitButton = buttons.at(1) - assert.equal(handleCancel.callCount, 0) + assert.strictEqual(handleCancel.callCount, 0) cancelButton.simulate('click') - assert.equal(handleCancel.callCount, 1) + assert.strictEqual(handleCancel.callCount, 1) - assert.equal(submitButton.props().disabled, true) - assert.equal(handleSubmit.callCount, 0) + assert.strictEqual(submitButton.props().disabled, true) + assert.strictEqual(handleSubmit.callCount, 0) submitButton.simulate('click') - assert.equal(handleSubmit.callCount, 0) + assert.strictEqual(handleSubmit.callCount, 0) }) }) diff --git a/ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js b/ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js index 12b1bae06..c10971110 100644 --- a/ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js +++ b/ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js @@ -9,18 +9,18 @@ describe('CancelTransactionGasFee Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find(UserPreferencedCurrencyDisplay).length, 2) + assert.strictEqual(wrapper.find(UserPreferencedCurrencyDisplay).length, 2) const ethDisplay = wrapper.find(UserPreferencedCurrencyDisplay).at(0) const fiatDisplay = wrapper.find(UserPreferencedCurrencyDisplay).at(1) - assert.equal(ethDisplay.props().value, '0x3b9aca00') - assert.equal( + assert.strictEqual(ethDisplay.props().value, '0x3b9aca00') + assert.strictEqual( ethDisplay.props().className, 'cancel-transaction-gas-fee__eth', ) - assert.equal(fiatDisplay.props().value, '0x3b9aca00') - assert.equal( + assert.strictEqual(fiatDisplay.props().value, '0x3b9aca00') + assert.strictEqual( fiatDisplay.props().className, 'cancel-transaction-gas-fee__fiat', ) diff --git a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js index 411cc8b27..64e08944a 100644 --- a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js +++ b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js @@ -15,17 +15,17 @@ describe('CancelTransaction Component', function () { }) assert.ok(wrapper) - assert.equal(wrapper.find(Modal).length, 1) - assert.equal(wrapper.find(CancelTransactionGasFee).length, 1) - assert.equal( + assert.strictEqual(wrapper.find(Modal).length, 1) + assert.strictEqual(wrapper.find(CancelTransactionGasFee).length, 1) + assert.strictEqual( wrapper.find(CancelTransactionGasFee).props().value, '0x1319718a5000', ) - assert.equal( + assert.strictEqual( wrapper.find('.cancel-transaction__title').text(), 'cancellationGasFee', ) - assert.equal( + assert.strictEqual( wrapper.find('.cancel-transaction__description').text(), 'attemptToCancelDescription', ) @@ -47,19 +47,19 @@ describe('CancelTransaction Component', function () { { context: { t } }, ) - assert.equal(wrapper.find(Modal).length, 1) + assert.strictEqual(wrapper.find(Modal).length, 1) const modalProps = wrapper.find(Modal).props() - assert.equal(modalProps.headerText, 'attemptToCancel') - assert.equal(modalProps.submitText, 'yesLetsTry') - assert.equal(modalProps.cancelText, 'nevermind') + assert.strictEqual(modalProps.headerText, 'attemptToCancel') + assert.strictEqual(modalProps.submitText, 'yesLetsTry') + assert.strictEqual(modalProps.cancelText, 'nevermind') - assert.equal(createCancelTransactionSpy.callCount, 0) - assert.equal(hideModalSpy.callCount, 0) + assert.strictEqual(createCancelTransactionSpy.callCount, 0) + assert.strictEqual(hideModalSpy.callCount, 0) await modalProps.onSubmit() - assert.equal(createCancelTransactionSpy.callCount, 1) - assert.equal(hideModalSpy.callCount, 1) + assert.strictEqual(createCancelTransactionSpy.callCount, 1) + assert.strictEqual(hideModalSpy.callCount, 1) modalProps.onCancel() - assert.equal(hideModalSpy.callCount, 2) + assert.strictEqual(hideModalSpy.callCount, 2) }) }) diff --git a/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js b/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js index 86329ec88..7d06ef459 100644 --- a/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js +++ b/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js @@ -30,7 +30,7 @@ describe('Confirm Delete Network', function () { it('renders delete network modal title', function () { const modalTitle = wrapper.find('.modal-content__title') - assert.equal(modalTitle.text(), 'deleteNetwork') + assert.strictEqual(modalTitle.text(), 'deleteNetwork') }) it('clicks cancel to hide modal', function () { diff --git a/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js b/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js index 5f239e665..e50b87308 100644 --- a/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js +++ b/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js @@ -61,7 +61,10 @@ describe('Confirm Remove Account', function () { remove.simulate('click') assert(props.removeAccount.calledOnce) - assert.equal(props.removeAccount.getCall(0).args[0], props.identity.address) + assert.strictEqual( + props.removeAccount.getCall(0).args[0], + props.identity.address, + ) setImmediate(() => { assert(props.hideModal.calledOnce) diff --git a/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js b/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js index ec113f108..5b9f4798d 100644 --- a/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js +++ b/ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js @@ -34,7 +34,10 @@ describe('MetaMetrics Opt In', function () { setImmediate(() => { assert(props.setParticipateInMetaMetrics.calledOnce) - assert.equal(props.setParticipateInMetaMetrics.getCall(0).args[0], false) + assert.strictEqual( + props.setParticipateInMetaMetrics.getCall(0).args[0], + false, + ) assert(props.hideModal.calledOnce) done() }) @@ -48,7 +51,10 @@ describe('MetaMetrics Opt In', function () { setImmediate(() => { assert(props.setParticipateInMetaMetrics.calledOnce) - assert.equal(props.setParticipateInMetaMetrics.getCall(0).args[0], true) + assert.strictEqual( + props.setParticipateInMetaMetrics.getCall(0).args[0], + true, + ) assert(props.hideModal.calledOnce) done() }) diff --git a/ui/app/components/app/modals/tests/account-details-modal.test.js b/ui/app/components/app/modals/tests/account-details-modal.test.js index 55b8b1b0a..62da1c56e 100644 --- a/ui/app/components/app/modals/tests/account-details-modal.test.js +++ b/ui/app/components/app/modals/tests/account-details-modal.test.js @@ -46,7 +46,7 @@ describe('Account Details Modal', function () { accountLabel.simulate('submit', 'New Label') assert(props.setAccountLabel.calledOnce) - assert.equal(props.setAccountLabel.getCall(0).args[1], 'New Label') + assert.strictEqual(props.setAccountLabel.getCall(0).args[1], 'New Label') }) it('opens new tab when view block explorer is clicked', function () { @@ -72,7 +72,7 @@ describe('Account Details Modal', function () { const modalButton = wrapper.find('.account-details-modal__button') const blockExplorerLink = modalButton.first() - assert.equal( + assert.strictEqual( blockExplorerLink.html(), '', ) diff --git a/ui/app/components/app/selected-account/tests/selected-account-component.test.js b/ui/app/components/app/selected-account/tests/selected-account-component.test.js index d0a608f3e..fcb924c25 100644 --- a/ui/app/components/app/selected-account/tests/selected-account-component.test.js +++ b/ui/app/components/app/selected-account/tests/selected-account-component.test.js @@ -15,10 +15,13 @@ describe('SelectedAccount Component', function () { { context: { t: () => undefined } }, ) // Checksummed version of address is displayed - assert.equal( + assert.strictEqual( wrapper.find('.selected-account__address').text(), '0x1B82...5C9D', ) - assert.equal(wrapper.find('.selected-account__name').text(), 'testName') + assert.strictEqual( + wrapper.find('.selected-account__name').text(), + 'testName', + ) }) }) diff --git a/ui/app/components/app/sidebars/tests/sidebars-component.test.js b/ui/app/components/app/sidebars/tests/sidebars-component.test.js index 22a7cbc2c..87d9377c0 100644 --- a/ui/app/components/app/sidebars/tests/sidebars-component.test.js +++ b/ui/app/components/app/sidebars/tests/sidebars-component.test.js @@ -41,9 +41,9 @@ describe('Sidebar Component', function () { }) it('should pass the correct onClick function to the element', function () { - assert.equal(propsMethodSpies.hideSidebar.callCount, 0) + assert.strictEqual(propsMethodSpies.hideSidebar.callCount, 0) renderOverlay.props().onClick() - assert.equal(propsMethodSpies.hideSidebar.callCount, 1) + assert.strictEqual(propsMethodSpies.hideSidebar.callCount, 1) }) }) @@ -64,26 +64,26 @@ describe('Sidebar Component', function () { it('should not render with an unrecognized type', function () { wrapper.setProps({ type: 'foobar' }) renderSidebarContent = wrapper.instance().renderSidebarContent() - assert.equal(renderSidebarContent, undefined) + assert.strictEqual(renderSidebarContent, null) }) }) describe('render', function () { it('should render a div with one child', function () { assert(wrapper.is('div')) - assert.equal(wrapper.children().length, 1) + assert.strictEqual(wrapper.children().length, 1) }) it('should render the ReactCSSTransitionGroup without any children', function () { assert(wrapper.children().at(0).is(ReactCSSTransitionGroup)) - assert.equal(wrapper.children().at(0).children().length, 0) + assert.strictEqual(wrapper.children().at(0).children().length, 0) }) it('should render sidebar content and the overlay if sidebarOpen is true', function () { wrapper.setProps({ sidebarOpen: true }) - assert.equal(wrapper.children().length, 2) + assert.strictEqual(wrapper.children().length, 2) assert(wrapper.children().at(1).hasClass('sidebar-overlay')) - assert.equal(wrapper.children().at(0).children().length, 1) + assert.strictEqual(wrapper.children().at(0).children().length, 1) assert(wrapper.children().at(0).children().at(0).hasClass('sidebar-left')) assert( wrapper diff --git a/ui/app/components/app/signature-request/tests/signature-request.test.js b/ui/app/components/app/signature-request/tests/signature-request.test.js index 331abac04..8966c014e 100644 --- a/ui/app/components/app/signature-request/tests/signature-request.test.js +++ b/ui/app/components/app/signature-request/tests/signature-request.test.js @@ -23,7 +23,7 @@ describe('Signature Request Component', function () { ) assert(wrapper.is('div')) - assert.equal(wrapper.length, 1) + assert.strictEqual(wrapper.length, 1) assert(wrapper.hasClass('signature-request')) }) }) diff --git a/ui/app/components/app/token-cell/token-cell.test.js b/ui/app/components/app/token-cell/token-cell.test.js index 1e876cfb3..08b4e545d 100644 --- a/ui/app/components/app/token-cell/token-cell.test.js +++ b/ui/app/components/app/token-cell/token-cell.test.js @@ -64,20 +64,32 @@ describe('Token Cell', function () { }) it('renders Identicon with props from token cell', function () { - assert.equal(wrapper.find(Identicon).prop('address'), '0xAnotherToken') - assert.equal(wrapper.find(Identicon).prop('image'), './test-image') + assert.strictEqual( + wrapper.find(Identicon).prop('address'), + '0xAnotherToken', + ) + assert.strictEqual(wrapper.find(Identicon).prop('image'), './test-image') }) it('renders token balance', function () { - assert.equal(wrapper.find('.asset-list-item__token-value').text(), '5.000') + assert.strictEqual( + wrapper.find('.asset-list-item__token-value').text(), + '5.000', + ) }) it('renders token symbol', function () { - assert.equal(wrapper.find('.asset-list-item__token-symbol').text(), 'TEST') + assert.strictEqual( + wrapper.find('.asset-list-item__token-symbol').text(), + 'TEST', + ) }) it('renders converted fiat amount', function () { - assert.equal(wrapper.find('.list-item__subheading').text(), '$0.52 USD') + assert.strictEqual( + wrapper.find('.list-item__subheading').text(), + '$0.52 USD', + ) }) it('calls onClick when clicked', function () { diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js index ec5cbb3df..d07f98764 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js @@ -109,7 +109,7 @@ describe('TransactionActivityLog Component', function () { assert.ok(wrapper.hasClass('transaction-activity-log')) assert.ok(wrapper.hasClass('test-class')) - assert.equal( + assert.strictEqual( wrapper.find('.transaction-activity-log__action-link').length, 2, ) @@ -166,7 +166,7 @@ describe('TransactionActivityLog Component', function () { assert.ok(wrapper.hasClass('transaction-activity-log')) assert.ok(wrapper.hasClass('test-class')) - assert.equal( + assert.strictEqual( wrapper.find('.transaction-activity-log__action-link').length, 0, ) diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js index b756a5962..f54f2ce94 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js @@ -22,7 +22,7 @@ describe('TransactionActivityLog container', function () { }, } - assert.deepEqual(mapStateToProps(mockState), { + assert.deepStrictEqual(mapStateToProps(mockState), { conversionRate: 280.45, nativeCurrency: 'ETH', }) diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.util.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.util.test.js index 5b9ab0662..8b03326db 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.util.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.util.test.js @@ -11,7 +11,7 @@ import { describe('TransactionActivityLog utils', function () { describe('combineTransactionHistories', function () { it('should return no activities for an empty list of transactions', function () { - assert.deepEqual(combineTransactionHistories([]), []) + assert.deepStrictEqual(combineTransactionHistories([]), []) }) it('should return activities for an array of transactions', function () { @@ -217,7 +217,10 @@ describe('TransactionActivityLog utils', function () { }, ] - assert.deepEqual(combineTransactionHistories(transactions), expected) + assert.deepStrictEqual( + combineTransactionHistories(transactions), + expected, + ) }) }) @@ -237,7 +240,7 @@ describe('TransactionActivityLog utils', function () { }, } - assert.deepEqual(getActivities(transaction), []) + assert.deepStrictEqual(getActivities(transaction), []) }) it("should return activities for a transaction's history", function () { @@ -412,7 +415,7 @@ describe('TransactionActivityLog utils', function () { }, ] - assert.deepEqual(getActivities(transaction, true), expectedResult) + assert.deepStrictEqual(getActivities(transaction, true), expectedResult) }) }) }) diff --git a/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js b/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js index e3083e504..db5ebef70 100644 --- a/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js +++ b/ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js @@ -14,11 +14,11 @@ describe('TransactionBreakdownRow Component', function () { ) assert.ok(wrapper.hasClass('transaction-breakdown-row')) - assert.equal( + assert.strictEqual( wrapper.find('.transaction-breakdown-row__title').text(), 'test', ) - assert.equal( + assert.strictEqual( wrapper.find('.transaction-breakdown-row__value').text(), 'Test', ) @@ -33,7 +33,7 @@ describe('TransactionBreakdownRow Component', function () { ) assert.ok(wrapper.hasClass('transaction-breakdown-row')) - assert.equal( + assert.strictEqual( wrapper.find('.transaction-breakdown-row__title').text(), 'test', ) diff --git a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js index 9d1e8c18b..5027cc05b 100644 --- a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js +++ b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js @@ -44,10 +44,10 @@ describe('TransactionListItemDetails Component', function () { ) const child = wrapper.childAt(0) assert.ok(child.hasClass('transaction-list-item-details')) - assert.equal(child.find(Button).length, 2) - assert.equal(child.find(SenderToRecipient).length, 1) - assert.equal(child.find(TransactionBreakdown).length, 1) - assert.equal(child.find(TransactionActivityLog).length, 1) + assert.strictEqual(child.find(Button).length, 2) + assert.strictEqual(child.find(SenderToRecipient).length, 1) + assert.strictEqual(child.find(TransactionBreakdown).length, 1) + assert.strictEqual(child.find(TransactionActivityLog).length, 1) }) it('should render a retry button', function () { @@ -90,7 +90,7 @@ describe('TransactionListItemDetails Component', function () { const child = wrapper.childAt(0) assert.ok(child.hasClass('transaction-list-item-details')) - assert.equal(child.find(Button).length, 3) + assert.strictEqual(child.find(Button).length, 3) }) it('should disable the Copy Tx ID and View In Etherscan buttons when tx hash is missing', function () { diff --git a/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js b/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js index d468d8d5f..016d4d5a9 100644 --- a/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js +++ b/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js @@ -17,7 +17,7 @@ describe('TransactionStatus Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.text(), 'June 1') + assert.strictEqual(wrapper.text(), 'June 1') }) it('should render PENDING properly when status is APPROVED', function () { @@ -30,8 +30,8 @@ describe('TransactionStatus Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.text(), 'PENDING') - assert.equal(wrapper.find(Tooltip).props().title, 'test-title') + assert.strictEqual(wrapper.text(), 'PENDING') + assert.strictEqual(wrapper.find(Tooltip).props().title, 'test-title') }) it('should render PENDING properly', function () { @@ -40,7 +40,7 @@ describe('TransactionStatus Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.text(), 'PENDING') + assert.strictEqual(wrapper.text(), 'PENDING') }) it('should render QUEUED properly', function () { @@ -51,7 +51,7 @@ describe('TransactionStatus Component', function () { wrapper.find('.transaction-status--queued').length, 'queued className not found', ) - assert.equal(wrapper.text(), 'QUEUED') + assert.strictEqual(wrapper.text(), 'QUEUED') }) it('should render UNAPPROVED properly', function () { @@ -62,7 +62,7 @@ describe('TransactionStatus Component', function () { wrapper.find('.transaction-status--unapproved').length, 'unapproved className not found', ) - assert.equal(wrapper.text(), 'UNAPPROVED') + assert.strictEqual(wrapper.text(), 'UNAPPROVED') }) after(function () { diff --git a/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js b/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js index 41b8ac862..4c2533de5 100644 --- a/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js +++ b/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js @@ -19,7 +19,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find(CurrencyDisplay).length, 1) + assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1) }) it('should pass all props to the CurrencyDisplay child component', function () { @@ -28,10 +28,10 @@ describe('UserPreferencedCurrencyDisplay Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find(CurrencyDisplay).length, 1) - assert.equal(wrapper.find(CurrencyDisplay).props().prop1, true) - assert.equal(wrapper.find(CurrencyDisplay).props().prop2, 'test') - assert.equal(wrapper.find(CurrencyDisplay).props().prop3, 1) + assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1) + assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop1, true) + assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop2, 'test') + assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop3, 1) }) afterEach(function () { sinon.restore() diff --git a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js index 63b9d42a5..30052e039 100644 --- a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js +++ b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js @@ -10,7 +10,7 @@ describe('UserPreferencedCurrencyInput Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find(CurrencyInput).length, 1) + assert.strictEqual(wrapper.find(CurrencyInput).length, 1) }) it('should render useFiat for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', function () { @@ -19,10 +19,10 @@ describe('UserPreferencedCurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find(CurrencyInput).length, 1) - assert.equal(wrapper.find(CurrencyInput).props().useFiat, false) + assert.strictEqual(wrapper.find(CurrencyInput).length, 1) + assert.strictEqual(wrapper.find(CurrencyInput).props().useFiat, false) wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false }) - assert.equal(wrapper.find(CurrencyInput).props().useFiat, true) + assert.strictEqual(wrapper.find(CurrencyInput).props().useFiat, true) }) }) }) diff --git a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js index 84c67f453..a687d469d 100644 --- a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js +++ b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js @@ -23,7 +23,7 @@ describe('UserPreferencedCurrencyInput container', function () { }, } - assert.deepEqual(mapStateToProps(mockState), { + assert.deepStrictEqual(mapStateToProps(mockState), { useNativeCurrencyAsPrimaryCurrency: true, }) }) diff --git a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js index ce882f6e5..dcc5b6874 100644 --- a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js +++ b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js @@ -12,7 +12,7 @@ describe('UserPreferencedCurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find(TokenInput).length, 1) + assert.strictEqual(wrapper.find(TokenInput).length, 1) }) it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', function () { @@ -24,10 +24,10 @@ describe('UserPreferencedCurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find(TokenInput).length, 1) - assert.equal(wrapper.find(TokenInput).props().showFiat, false) + assert.strictEqual(wrapper.find(TokenInput).length, 1) + assert.strictEqual(wrapper.find(TokenInput).props().showFiat, false) wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false }) - assert.equal(wrapper.find(TokenInput).props().showFiat, true) + assert.strictEqual(wrapper.find(TokenInput).props().showFiat, true) }) }) }) diff --git a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js index f7bef30e4..8011f4885 100644 --- a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js +++ b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js @@ -23,7 +23,7 @@ describe('UserPreferencedTokenInput container', function () { }, } - assert.deepEqual(mapStateToProps(mockState), { + assert.deepStrictEqual(mapStateToProps(mockState), { useNativeCurrencyAsPrimaryCurrency: true, }) }) diff --git a/ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js b/ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js index f49935770..733d81241 100644 --- a/ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js +++ b/ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js @@ -20,11 +20,11 @@ describe('AccountMismatchWarning', function () { }) it('renders nothing when the addresses match', function () { const wrapper = shallow() - assert.equal(wrapper.find(InfoIcon).length, 0) + assert.strictEqual(wrapper.find(InfoIcon).length, 0) }) it('renders a warning info icon when addresses do not match', function () { const wrapper = shallow() - assert.equal(wrapper.find(InfoIcon).length, 1) + assert.strictEqual(wrapper.find(InfoIcon).length, 1) }) after(function () { sinon.restore() diff --git a/ui/app/components/ui/alert/tests/alert.test.js b/ui/app/components/ui/alert/tests/alert.test.js index f69a59b06..c8d36528b 100644 --- a/ui/app/components/ui/alert/tests/alert.test.js +++ b/ui/app/components/ui/alert/tests/alert.test.js @@ -13,7 +13,7 @@ describe('Alert', function () { it('renders nothing with no visible boolean in state', function () { const alert = wrapper.find('.global-alert') - assert.equal(alert.length, 0) + assert.strictEqual(alert.length, 0) }) it('renders when visible in state is true, and message', function () { @@ -22,10 +22,10 @@ describe('Alert', function () { wrapper.setState({ visible: true, msg: errorMessage }) const alert = wrapper.find('.global-alert') - assert.equal(alert.length, 1) + assert.strictEqual(alert.length, 1) const errorText = wrapper.find('.msg') - assert.equal(errorText.text(), errorMessage) + assert.strictEqual(errorText.text(), errorMessage) }) it('calls component method when componentWillReceiveProps is called', function () { diff --git a/ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js b/ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js index cbbbfd8e2..9d9abbdc6 100644 --- a/ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js +++ b/ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js @@ -8,17 +8,17 @@ describe('Breadcrumbs Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find('.breadcrumbs').length, 1) - assert.equal(wrapper.find('.breadcrumb').length, 3) - assert.equal( + assert.strictEqual(wrapper.find('.breadcrumbs').length, 1) + assert.strictEqual(wrapper.find('.breadcrumb').length, 3) + assert.strictEqual( wrapper.find('.breadcrumb').at(0).props().style.backgroundColor, '#FFFFFF', ) - assert.equal( + assert.strictEqual( wrapper.find('.breadcrumb').at(1).props().style.backgroundColor, '#D8D8D8', ) - assert.equal( + assert.strictEqual( wrapper.find('.breadcrumb').at(2).props().style.backgroundColor, '#FFFFFF', ) diff --git a/ui/app/components/ui/button-group/tests/button-group-component.test.js b/ui/app/components/ui/button-group/tests/button-group-component.test.js index 28f54cf57..e64c866fa 100644 --- a/ui/app/components/ui/button-group/tests/button-group-component.test.js +++ b/ui/app/components/ui/button-group/tests/button-group-component.test.js @@ -49,77 +49,80 @@ describe('ButtonGroup Component', function () { describe('componentDidUpdate', function () { it('should set the activeButtonIndex to the updated newActiveButtonIndex', function () { - assert.equal(wrapper.state('activeButtonIndex'), 1) + assert.strictEqual(wrapper.state('activeButtonIndex'), 1) wrapper.setProps({ newActiveButtonIndex: 2 }) - assert.equal(wrapper.state('activeButtonIndex'), 2) + assert.strictEqual(wrapper.state('activeButtonIndex'), 2) }) it('should not set the activeButtonIndex to an updated newActiveButtonIndex that is not a number', function () { - assert.equal(wrapper.state('activeButtonIndex'), 1) + assert.strictEqual(wrapper.state('activeButtonIndex'), 1) wrapper.setProps({ newActiveButtonIndex: null }) - assert.equal(wrapper.state('activeButtonIndex'), 1) + assert.strictEqual(wrapper.state('activeButtonIndex'), 1) }) }) describe('handleButtonClick', function () { it('should set the activeButtonIndex', function () { - assert.equal(wrapper.state('activeButtonIndex'), 1) + assert.strictEqual(wrapper.state('activeButtonIndex'), 1) wrapper.instance().handleButtonClick(2) - assert.equal(wrapper.state('activeButtonIndex'), 2) + assert.strictEqual(wrapper.state('activeButtonIndex'), 2) }) }) describe('renderButtons', function () { it('should render a button for each child', function () { const childButtons = wrapper.find('.button-group__button') - assert.equal(childButtons.length, 3) + assert.strictEqual(childButtons.length, 3) }) it('should render the correct button with an active state', function () { const childButtons = wrapper.find('.button-group__button') const activeChildButton = wrapper.find('.button-group__button--active') - assert.deepEqual(childButtons.get(1), activeChildButton.get(0)) + assert.deepStrictEqual(childButtons.get(1), activeChildButton.get(0)) }) it("should call handleButtonClick and the respective button's onClick method when a button is clicked", function () { - assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 0) - assert.equal(childButtonSpies.onClick.callCount, 0) + assert.strictEqual(ButtonGroup.prototype.handleButtonClick.callCount, 0) + assert.strictEqual(childButtonSpies.onClick.callCount, 0) const childButtons = wrapper.find('.button-group__button') childButtons.at(0).props().onClick() childButtons.at(1).props().onClick() childButtons.at(2).props().onClick() - assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 3) - assert.equal(childButtonSpies.onClick.callCount, 3) + assert.strictEqual(ButtonGroup.prototype.handleButtonClick.callCount, 3) + assert.strictEqual(childButtonSpies.onClick.callCount, 3) }) it('should render all child buttons as disabled if props.disabled is true', function () { const childButtons = wrapper.find('.button-group__button') childButtons.forEach((button) => { - assert.equal(button.props().disabled, undefined) + assert.strictEqual(button.props().disabled, undefined) }) wrapper.setProps({ disabled: true }) const disabledChildButtons = wrapper.find('[disabled=true]') - assert.equal(disabledChildButtons.length, 3) + assert.strictEqual(disabledChildButtons.length, 3) }) it('should render the children of the button', function () { const mockClass = wrapper.find('.mockClass') - assert.equal(mockClass.length, 1) + assert.strictEqual(mockClass.length, 1) }) }) describe('render', function () { it('should render a div with the expected class and style', function () { - assert.equal(wrapper.find('div').at(0).props().className, 'someClassName') - assert.deepEqual(wrapper.find('div').at(0).props().style, { + assert.strictEqual( + wrapper.find('div').at(0).props().className, + 'someClassName', + ) + assert.deepStrictEqual(wrapper.find('div').at(0).props().style, { color: 'red', }) }) it('should call renderButtons when rendering', function () { - assert.equal(ButtonGroup.prototype.renderButtons.callCount, 1) + assert.strictEqual(ButtonGroup.prototype.renderButtons.callCount, 1) wrapper.instance().render() - assert.equal(ButtonGroup.prototype.renderButtons.callCount, 2) + assert.strictEqual(ButtonGroup.prototype.renderButtons.callCount, 2) }) }) }) diff --git a/ui/app/components/ui/card/tests/card.component.test.js b/ui/app/components/ui/card/tests/card.component.test.js index 4fc92252a..efd05e727 100644 --- a/ui/app/components/ui/card/tests/card.component.test.js +++ b/ui/app/components/ui/card/tests/card.component.test.js @@ -14,9 +14,9 @@ describe('Card Component', function () { assert.ok(wrapper.hasClass('card-test-class')) const title = wrapper.find('.card__title') assert.ok(title) - assert.equal(title.text(), 'Test') + assert.strictEqual(title.text(), 'Test') const child = wrapper.find('.child-test-class') assert.ok(child) - assert.equal(child.text(), 'Child') + assert.strictEqual(child.text(), 'Child') }) }) diff --git a/ui/app/components/ui/currency-display/tests/currency-display.component.test.js b/ui/app/components/ui/currency-display/tests/currency-display.component.test.js index 9e023aef3..8fd0bb4ba 100644 --- a/ui/app/components/ui/currency-display/tests/currency-display.component.test.js +++ b/ui/app/components/ui/currency-display/tests/currency-display.component.test.js @@ -24,7 +24,7 @@ describe('CurrencyDisplay Component', function () { ) assert.ok(wrapper.hasClass('currency-display')) - assert.equal(wrapper.text(), '$123.45') + assert.strictEqual(wrapper.text(), '$123.45') }) it('should render text with a prefix', function () { @@ -38,7 +38,7 @@ describe('CurrencyDisplay Component', function () { ) assert.ok(wrapper.hasClass('currency-display')) - assert.equal(wrapper.text(), '-$123.45') + assert.strictEqual(wrapper.text(), '-$123.45') }) afterEach(function () { sinon.restore() diff --git a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js index d4d88be02..e6e05a33b 100644 --- a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js +++ b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js @@ -15,7 +15,7 @@ describe('CurrencyInput Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find(UnitInput).length, 1) + assert.strictEqual(wrapper.find(UnitInput).length, 1) }) it('should render properly with a suffix', function () { @@ -39,9 +39,9 @@ describe('CurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') - assert.equal(wrapper.find(CurrencyDisplay).length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH') + assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1) }) it('should render properly with an ETH value', function () { @@ -69,12 +69,15 @@ describe('CurrencyInput Component', function () { assert.ok(wrapper) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 1) - assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') - assert.equal(wrapper.find('.unit-input__input').props().value, '1') - assert.equal( + assert.strictEqual(currencyInputInstance.state.decimalValue, 1) + assert.strictEqual( + currencyInputInstance.state.hexValue, + 'de0b6b3a7640000', + ) + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH') + assert.strictEqual(wrapper.find('.unit-input__input').props().value, 1) + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$231.06USD', ) @@ -106,12 +109,12 @@ describe('CurrencyInput Component', function () { assert.ok(wrapper) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 1) - assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'USD') - assert.equal(wrapper.find('.unit-input__input').props().value, '1') - assert.equal( + assert.strictEqual(currencyInputInstance.state.decimalValue, 1) + assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'USD') + assert.strictEqual(wrapper.find('.unit-input__input').props().value, 1) + assert.strictEqual( wrapper.find('.currency-display-component').text(), '0.004328ETH', ) @@ -148,12 +151,15 @@ describe('CurrencyInput Component', function () { assert.ok(wrapper) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 0.004328) - assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') - assert.equal(wrapper.find('.unit-input__input').props().value, '0.004328') - assert.equal( + assert.strictEqual(currencyInputInstance.state.decimalValue, 0.004328) + assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH') + assert.strictEqual( + wrapper.find('.unit-input__input').props().value, + 0.004328, + ) + assert.strictEqual( wrapper.find('.currency-input__conversion-component').text(), 'noConversionRateAvailable_t', ) @@ -191,28 +197,31 @@ describe('CurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) - assert.equal(handleBlurSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) + assert.strictEqual(handleBlurSpy.callCount, 0) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 0) - assert.equal(currencyInputInstance.state.hexValue, undefined) - assert.equal( + assert.strictEqual(currencyInputInstance.state.decimalValue, 0) + assert.strictEqual(currencyInputInstance.state.hexValue, undefined) + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$0.00USD', ) const input = wrapper.find('input') - assert.equal(input.props().value, 0) + assert.strictEqual(input.props().value, 0) input.simulate('change', { target: { value: 1 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000')) - assert.equal( + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$231.06USD', ) - assert.equal(currencyInputInstance.state.decimalValue, 1) - assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') + assert.strictEqual(currencyInputInstance.state.decimalValue, 1) + assert.strictEqual( + currencyInputInstance.state.hexValue, + 'de0b6b3a7640000', + ) }) it('should call onChange on input changes with the hex value for fiat', function () { @@ -238,25 +247,28 @@ describe('CurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) - assert.equal(handleBlurSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) + assert.strictEqual(handleBlurSpy.callCount, 0) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 0) - assert.equal(currencyInputInstance.state.hexValue, undefined) - assert.equal(wrapper.find('.currency-display-component').text(), '0ETH') + assert.strictEqual(currencyInputInstance.state.decimalValue, 0) + assert.strictEqual(currencyInputInstance.state.hexValue, undefined) + assert.strictEqual( + wrapper.find('.currency-display-component').text(), + '0ETH', + ) const input = wrapper.find('input') - assert.equal(input.props().value, 0) + assert.strictEqual(input.props().value, 0) input.simulate('change', { target: { value: 1 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith('f602f2234d0ea')) - assert.equal( + assert.strictEqual( wrapper.find('.currency-display-component').text(), '0.004328ETH', ) - assert.equal(currencyInputInstance.state.decimalValue, 1) - assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') + assert.strictEqual(currencyInputInstance.state.decimalValue, 1) + assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea') }) it('should change the state and pass in a new decimalValue when props.value changes', function () { @@ -283,15 +295,18 @@ describe('CurrencyInput Component', function () { assert.ok(wrapper) const currencyInputInstance = wrapper.find(CurrencyInput).dive() - assert.equal(currencyInputInstance.state('decimalValue'), 0) - assert.equal(currencyInputInstance.state('hexValue'), undefined) - assert.equal(currencyInputInstance.find(UnitInput).props().value, 0) + assert.strictEqual(currencyInputInstance.state('decimalValue'), 0) + assert.strictEqual(currencyInputInstance.state('hexValue'), undefined) + assert.strictEqual(currencyInputInstance.find(UnitInput).props().value, 0) currencyInputInstance.setProps({ value: '1ec05e43e72400' }) currencyInputInstance.update() - assert.equal(currencyInputInstance.state('decimalValue'), 2) - assert.equal(currencyInputInstance.state('hexValue'), '1ec05e43e72400') - assert.equal(currencyInputInstance.find(UnitInput).props().value, 2) + assert.strictEqual(currencyInputInstance.state('decimalValue'), 2) + assert.strictEqual( + currencyInputInstance.state('hexValue'), + '1ec05e43e72400', + ) + assert.strictEqual(currencyInputInstance.find(UnitInput).props().value, 2) }) it('should swap selected currency when swap icon is clicked', function () { @@ -317,32 +332,35 @@ describe('CurrencyInput Component', function () { ) assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) - assert.equal(handleBlurSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) + assert.strictEqual(handleBlurSpy.callCount, 0) const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() - assert.equal(currencyInputInstance.state.decimalValue, 0) - assert.equal(currencyInputInstance.state.hexValue, undefined) - assert.equal( + assert.strictEqual(currencyInputInstance.state.decimalValue, 0) + assert.strictEqual(currencyInputInstance.state.hexValue, undefined) + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$0.00USD', ) const input = wrapper.find('input') - assert.equal(input.props().value, 0) + assert.strictEqual(input.props().value, 0) input.simulate('change', { target: { value: 1 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000')) - assert.equal( + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$231.06USD', ) - assert.equal(currencyInputInstance.state.decimalValue, 1) - assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') + assert.strictEqual(currencyInputInstance.state.decimalValue, 1) + assert.strictEqual( + currencyInputInstance.state.hexValue, + 'de0b6b3a7640000', + ) const swap = wrapper.find('.currency-input__swap-component') swap.simulate('click') - assert.equal( + assert.strictEqual( wrapper.find('.currency-display-component').text(), '0.004328ETH', ) diff --git a/ui/app/components/ui/currency-input/tests/currency-input.container.test.js b/ui/app/components/ui/currency-input/tests/currency-input.container.test.js index 3dac9add0..1ce9eb559 100644 --- a/ui/app/components/ui/currency-input/tests/currency-input.container.test.js +++ b/ui/app/components/ui/currency-input/tests/currency-input.container.test.js @@ -131,7 +131,7 @@ describe('CurrencyInput container', function () { tests.forEach(({ mockState, expected, comment }) => { it(comment, function () { - return assert.deepEqual(mapStateToProps(mockState), expected) + return assert.deepStrictEqual(mapStateToProps(mockState), expected) }) }) }) @@ -189,7 +189,7 @@ describe('CurrencyInput container', function () { comment, }) => { it(comment, function () { - assert.deepEqual( + assert.deepStrictEqual( mergeProps(stateProps, dispatchProps, ownProps), expected, ) diff --git a/ui/app/components/ui/error-message/tests/error-message.component.test.js b/ui/app/components/ui/error-message/tests/error-message.component.test.js index 5bf05d876..884fe6565 100644 --- a/ui/app/components/ui/error-message/tests/error-message.component.test.js +++ b/ui/app/components/ui/error-message/tests/error-message.component.test.js @@ -12,9 +12,9 @@ describe('ErrorMessage Component', function () { }) assert.ok(wrapper) - assert.equal(wrapper.find('.error-message').length, 1) - assert.equal(wrapper.find('.error-message__icon').length, 1) - assert.equal( + assert.strictEqual(wrapper.find('.error-message').length, 1) + assert.strictEqual(wrapper.find('.error-message__icon').length, 1) + assert.strictEqual( wrapper.find('.error-message__text').text(), 'ALERT: This is an error.', ) @@ -26,9 +26,9 @@ describe('ErrorMessage Component', function () { }) assert.ok(wrapper) - assert.equal(wrapper.find('.error-message').length, 1) - assert.equal(wrapper.find('.error-message__icon').length, 1) - assert.equal( + assert.strictEqual(wrapper.find('.error-message').length, 1) + assert.strictEqual(wrapper.find('.error-message__icon').length, 1) + assert.strictEqual( wrapper.find('.error-message__text').text(), 'ALERT: translate testKey', ) diff --git a/ui/app/components/ui/hex-to-decimal/tests/hex-to-decimal.component.test.js b/ui/app/components/ui/hex-to-decimal/tests/hex-to-decimal.component.test.js index 3d8086630..cb75bfd63 100644 --- a/ui/app/components/ui/hex-to-decimal/tests/hex-to-decimal.component.test.js +++ b/ui/app/components/ui/hex-to-decimal/tests/hex-to-decimal.component.test.js @@ -10,7 +10,7 @@ describe('HexToDecimal Component', function () { ) assert.ok(wrapper.hasClass('hex-to-decimal')) - assert.equal(wrapper.text(), '12345') + assert.strictEqual(wrapper.text(), '12345') }) it('should render an unprefixed hex as a decimal with a className', function () { @@ -19,6 +19,6 @@ describe('HexToDecimal Component', function () { ) assert.ok(wrapper.hasClass('hex-to-decimal')) - assert.equal(wrapper.text(), '6789') + assert.strictEqual(wrapper.text(), '6789') }) }) diff --git a/ui/app/components/ui/identicon/tests/identicon.component.test.js b/ui/app/components/ui/identicon/tests/identicon.component.test.js index f07fb2d96..c938657ab 100644 --- a/ui/app/components/ui/identicon/tests/identicon.component.test.js +++ b/ui/app/components/ui/identicon/tests/identicon.component.test.js @@ -19,7 +19,7 @@ describe('Identicon', function () { it('renders default eth_logo identicon with no props', function () { const wrapper = mount() - assert.equal( + assert.strictEqual( wrapper.find('img.identicon__eth-logo').prop('src'), './images/eth_logo.svg', ) @@ -30,11 +30,11 @@ describe('Identicon', function () { , ) - assert.equal( + assert.strictEqual( wrapper.find('img.test-image').prop('className'), 'identicon test-image', ) - assert.equal(wrapper.find('img.test-image').prop('src'), 'test-image') + assert.strictEqual(wrapper.find('img.test-image').prop('src'), 'test-image') }) it('renders div with address prop', function () { @@ -42,7 +42,7 @@ describe('Identicon', function () { , ) - assert.equal( + assert.strictEqual( wrapper.find('div.test-address').prop('className'), 'identicon test-address', ) diff --git a/ui/app/components/ui/list-item/tests/list-item.test.js b/ui/app/components/ui/list-item/tests/list-item.test.js index 94d42ea3c..6f9e132cd 100644 --- a/ui/app/components/ui/list-item/tests/list-item.test.js +++ b/ui/app/components/ui/list-item/tests/list-item.test.js @@ -35,13 +35,13 @@ describe('ListItem', function () { ) }) it('includes the data-testid', function () { - assert.equal(wrapper.props()['data-testid'], 'test-id') + assert.strictEqual(wrapper.props()['data-testid'], 'test-id') }) it(`renders "${TITLE}" title`, function () { - assert.equal(wrapper.find('.list-item__heading h2').text(), TITLE) + assert.strictEqual(wrapper.find('.list-item__heading h2').text(), TITLE) }) it(`renders "I am a list item" subtitle`, function () { - assert.equal( + assert.strictEqual( wrapper.find('.list-item__subheading').text(), 'I am a list item', ) @@ -50,19 +50,19 @@ describe('ListItem', function () { assert(wrapper.props().className.includes(CLASSNAME)) }) it('renders content on the right side of the list item', function () { - assert.equal( + assert.strictEqual( wrapper.find('.list-item__right-content p').text(), 'Content rendered to the right', ) }) it('renders content in the middle of the list item', function () { - assert.equal( + assert.strictEqual( wrapper.find('.list-item__mid-content p').text(), 'Content rendered in the middle', ) }) it('renders list item actions', function () { - assert.equal( + assert.strictEqual( wrapper.find('.list-item__actions button').text(), 'I am a button', ) @@ -75,7 +75,7 @@ describe('ListItem', function () { }) it('handles click action and fires onClick', function () { wrapper.simulate('click') - assert.equal(clickHandler.callCount, 1) + assert.strictEqual(clickHandler.callCount, 1) }) after(function () { diff --git a/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js b/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js index ab2fd753b..5ea89c620 100644 --- a/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js +++ b/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js @@ -7,11 +7,11 @@ describe('MetaFoxLogo', function () { it('sets icon height and width to 42 by default', function () { const wrapper = mount() - assert.equal( + assert.strictEqual( wrapper.find('img.app-header__metafox-logo--icon').prop('width'), 42, ) - assert.equal( + assert.strictEqual( wrapper.find('img.app-header__metafox-logo--icon').prop('height'), 42, ) @@ -20,13 +20,13 @@ describe('MetaFoxLogo', function () { it('does not set icon height and width when unsetIconHeight is true', function () { const wrapper = mount() - assert.equal( + assert.strictEqual( wrapper.find('img.app-header__metafox-logo--icon').prop('width'), - null, + undefined, ) - assert.equal( + assert.strictEqual( wrapper.find('img.app-header__metafox-logo--icon').prop('height'), - null, + undefined, ) }) }) diff --git a/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js b/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js index ff41417a3..4fd9b039c 100644 --- a/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js +++ b/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js @@ -24,7 +24,7 @@ describe('Page Footer', function () { }) it('renders page container footer', function () { - assert.equal(wrapper.find('.page-container__footer').length, 1) + assert.strictEqual(wrapper.find('.page-container__footer').length, 1) }) it('should render a secondary footer inside page-container__footer when given children', function () { @@ -35,23 +35,26 @@ describe('Page Footer', function () { { context: { t: sinon.spy((k) => `[${k}]`) } }, ) - assert.equal(wrapper.find('.page-container__footer-secondary').length, 1) + assert.strictEqual( + wrapper.find('.page-container__footer-secondary').length, + 1, + ) }) it('renders two button components', function () { - assert.equal(wrapper.find(Button).length, 2) + assert.strictEqual(wrapper.find(Button).length, 2) }) describe('Cancel Button', function () { it('has button type of default', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__footer-button').first().prop('type'), 'default', ) }) it('has children text of Cancel', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__footer-button').first().prop('children'), 'Cancel', ) @@ -59,27 +62,27 @@ describe('Page Footer', function () { it('should call cancel when click is simulated', function () { wrapper.find('.page-container__footer-button').first().prop('onClick')() - assert.equal(onCancel.callCount, 1) + assert.strictEqual(onCancel.callCount, 1) }) }) describe('Submit Button', function () { it('assigns button type based on props', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__footer-button').last().prop('type'), 'Test Type', ) }) it('has disabled prop', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__footer-button').last().prop('disabled'), false, ) }) it('has children text when submitText prop exists', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__footer-button').last().prop('children'), 'Submit', ) @@ -87,7 +90,7 @@ describe('Page Footer', function () { it('should call submit when click is simulated', function () { wrapper.find('.page-container__footer-button').last().prop('onClick')() - assert.equal(onSubmit.callCount, 1) + assert.strictEqual(onSubmit.callCount, 1) }) }) }) diff --git a/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js b/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js index ab035c641..c686e3490 100644 --- a/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js +++ b/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js @@ -27,12 +27,15 @@ describe('Page Container Header', function () { describe('Render Header Row', function () { it('renders back button', function () { - assert.equal(wrapper.find('.page-container__back-button').length, 1) - assert.equal(wrapper.find('.page-container__back-button').text(), 'Back') + assert.strictEqual(wrapper.find('.page-container__back-button').length, 1) + assert.strictEqual( + wrapper.find('.page-container__back-button').text(), + 'Back', + ) }) it('ensures style prop', function () { - assert.equal( + assert.strictEqual( wrapper.find('.page-container__back-button').props().style, style, ) @@ -40,7 +43,7 @@ describe('Page Container Header', function () { it('should call back button when click is simulated', function () { wrapper.find('.page-container__back-button').prop('onClick')() - assert.equal(onBackButtonClick.callCount, 1) + assert.strictEqual(onBackButtonClick.callCount, 1) }) }) @@ -57,29 +60,29 @@ describe('Page Container Header', function () { }) it('renders page container', function () { - assert.equal(header.length, 1) - assert.equal(headerRow.length, 1) - assert.equal(pageTitle.length, 1) - assert.equal(pageSubtitle.length, 1) - assert.equal(pageClose.length, 1) - assert.equal(pageTab.length, 1) + assert.strictEqual(header.length, 1) + assert.strictEqual(headerRow.length, 1) + assert.strictEqual(pageTitle.length, 1) + assert.strictEqual(pageSubtitle.length, 1) + assert.strictEqual(pageClose.length, 1) + assert.strictEqual(pageTab.length, 1) }) it('renders title', function () { - assert.equal(pageTitle.text(), 'Test Title') + assert.strictEqual(pageTitle.text(), 'Test Title') }) it('renders subtitle', function () { - assert.equal(pageSubtitle.text(), 'Test Subtitle') + assert.strictEqual(pageSubtitle.text(), 'Test Subtitle') }) it('renders tabs', function () { - assert.equal(pageTab.text(), 'Test Tab') + assert.strictEqual(pageTab.text(), 'Test Tab') }) it('should call close when click is simulated', function () { pageClose.prop('onClick')() - assert.equal(onClose.callCount, 1) + assert.strictEqual(onClose.callCount, 1) }) }) }) diff --git a/ui/app/components/ui/token-input/tests/token-input.component.test.js b/ui/app/components/ui/token-input/tests/token-input.component.test.js index 52668a1cc..e6542b3e2 100644 --- a/ui/app/components/ui/token-input/tests/token-input.component.test.js +++ b/ui/app/components/ui/token-input/tests/token-input.component.test.js @@ -41,13 +41,13 @@ describe('TokenInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') - assert.equal( + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC') + assert.strictEqual( wrapper.find('.currency-input__conversion-component').length, 1, ) - assert.equal( + assert.strictEqual( wrapper.find('.currency-input__conversion-component').text(), 'translate noConversionRateAvailable', ) @@ -82,9 +82,9 @@ describe('TokenInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') - assert.equal(wrapper.find(CurrencyDisplay).length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC') + assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1) }) it('should render properly with a token value for ETH', function () { @@ -112,12 +112,15 @@ describe('TokenInput Component', function () { assert.ok(wrapper) const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() - assert.equal(tokenInputInstance.state.decimalValue, 1) - assert.equal(tokenInputInstance.state.hexValue, '2710') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') - assert.equal(wrapper.find('.unit-input__input').props().value, '1') - assert.equal(wrapper.find('.currency-display-component').text(), '2ETH') + assert.strictEqual(tokenInputInstance.state.decimalValue, '1') + assert.strictEqual(tokenInputInstance.state.hexValue, '2710') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC') + assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1') + assert.strictEqual( + wrapper.find('.currency-display-component').text(), + '2ETH', + ) }) it('should render properly with a token value for fiat', function () { @@ -146,12 +149,12 @@ describe('TokenInput Component', function () { assert.ok(wrapper) const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() - assert.equal(tokenInputInstance.state.decimalValue, 1) - assert.equal(tokenInputInstance.state.hexValue, '2710') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') - assert.equal(wrapper.find('.unit-input__input').props().value, '1') - assert.equal( + assert.strictEqual(tokenInputInstance.state.decimalValue, '1') + assert.strictEqual(tokenInputInstance.state.hexValue, '2710') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC') + assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1') + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$462.12USD', ) @@ -190,12 +193,12 @@ describe('TokenInput Component', function () { assert.ok(wrapper) const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() - assert.equal(tokenInputInstance.state.decimalValue, 1) - assert.equal(tokenInputInstance.state.hexValue, '2710') - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') - assert.equal(wrapper.find('.unit-input__input').props().value, '1') - assert.equal( + assert.strictEqual(tokenInputInstance.state.decimalValue, '1') + assert.strictEqual(tokenInputInstance.state.hexValue, '2710') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC') + assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1') + assert.strictEqual( wrapper.find('.currency-input__conversion-component').text(), 'translate noConversionRateAvailable', ) @@ -234,22 +237,28 @@ describe('TokenInput Component', function () { ) assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) - assert.equal(handleBlurSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) + assert.strictEqual(handleBlurSpy.callCount, 0) const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() - assert.equal(tokenInputInstance.state.decimalValue, 0) - assert.equal(tokenInputInstance.state.hexValue, undefined) - assert.equal(wrapper.find('.currency-display-component').text(), '0ETH') + assert.strictEqual(tokenInputInstance.state.decimalValue, 0) + assert.strictEqual(tokenInputInstance.state.hexValue, undefined) + assert.strictEqual( + wrapper.find('.currency-display-component').text(), + '0ETH', + ) const input = wrapper.find('input') - assert.equal(input.props().value, 0) + assert.strictEqual(input.props().value, 0) input.simulate('change', { target: { value: 1 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith('2710')) - assert.equal(wrapper.find('.currency-display-component').text(), '2ETH') - assert.equal(tokenInputInstance.state.decimalValue, 1) - assert.equal(tokenInputInstance.state.hexValue, '2710') + assert.strictEqual( + wrapper.find('.currency-display-component').text(), + '2ETH', + ) + assert.strictEqual(tokenInputInstance.state.decimalValue, 1) + assert.strictEqual(tokenInputInstance.state.hexValue, '2710') }) it('should call onChange on input changes with the hex value for fiat', function () { @@ -276,28 +285,28 @@ describe('TokenInput Component', function () { ) assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) - assert.equal(handleBlurSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) + assert.strictEqual(handleBlurSpy.callCount, 0) const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() - assert.equal(tokenInputInstance.state.decimalValue, 0) - assert.equal(tokenInputInstance.state.hexValue, undefined) - assert.equal( + assert.strictEqual(tokenInputInstance.state.decimalValue, 0) + assert.strictEqual(tokenInputInstance.state.hexValue, undefined) + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$0.00USD', ) const input = wrapper.find('input') - assert.equal(input.props().value, 0) + assert.strictEqual(input.props().value, 0) input.simulate('change', { target: { value: 1 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith('2710')) - assert.equal( + assert.strictEqual( wrapper.find('.currency-display-component').text(), '$462.12USD', ) - assert.equal(tokenInputInstance.state.decimalValue, 1) - assert.equal(tokenInputInstance.state.hexValue, '2710') + assert.strictEqual(tokenInputInstance.state.decimalValue, 1) + assert.strictEqual(tokenInputInstance.state.hexValue, '2710') }) it('should change the state and pass in a new decimalValue when props.value changes', function () { @@ -325,15 +334,15 @@ describe('TokenInput Component', function () { assert.ok(wrapper) const tokenInputInstance = wrapper.find(TokenInput).dive() - assert.equal(tokenInputInstance.state('decimalValue'), 0) - assert.equal(tokenInputInstance.state('hexValue'), undefined) - assert.equal(tokenInputInstance.find(UnitInput).props().value, 0) + assert.strictEqual(tokenInputInstance.state('decimalValue'), 0) + assert.strictEqual(tokenInputInstance.state('hexValue'), undefined) + assert.strictEqual(tokenInputInstance.find(UnitInput).props().value, 0) tokenInputInstance.setProps({ value: '2710' }) tokenInputInstance.update() - assert.equal(tokenInputInstance.state('decimalValue'), 1) - assert.equal(tokenInputInstance.state('hexValue'), '2710') - assert.equal(tokenInputInstance.find(UnitInput).props().value, 1) + assert.strictEqual(tokenInputInstance.state('decimalValue'), '1') + assert.strictEqual(tokenInputInstance.state('hexValue'), '2710') + assert.strictEqual(tokenInputInstance.find(UnitInput).props().value, '1') }) }) }) diff --git a/ui/app/components/ui/unit-input/tests/unit-input.component.test.js b/ui/app/components/ui/unit-input/tests/unit-input.component.test.js index c759f496f..47fdfafde 100644 --- a/ui/app/components/ui/unit-input/tests/unit-input.component.test.js +++ b/ui/app/components/ui/unit-input/tests/unit-input.component.test.js @@ -10,15 +10,15 @@ describe('UnitInput Component', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input__suffix').length, 0) + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 0) }) it('should render properly with a suffix', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input__suffix').length, 1) - assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') + assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1) + assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH') }) it('should render properly with a child component', function () { @@ -29,15 +29,15 @@ describe('UnitInput Component', function () { ) assert.ok(wrapper) - assert.equal(wrapper.find('.testing').length, 1) - assert.equal(wrapper.find('.testing').text(), 'TESTCOMPONENT') + assert.strictEqual(wrapper.find('.testing').length, 1) + assert.strictEqual(wrapper.find('.testing').text(), 'TESTCOMPONENT') }) it('should render with an error class when props.error === true', function () { const wrapper = shallow() assert.ok(wrapper) - assert.equal(wrapper.find('.unit-input--error').length, 1) + assert.strictEqual(wrapper.find('.unit-input--error').length, 1) }) }) @@ -57,43 +57,43 @@ describe('UnitInput Component', function () { const handleFocusSpy = sinon.spy(wrapper.instance(), 'handleFocus') wrapper.instance().forceUpdate() wrapper.update() - assert.equal(handleFocusSpy.callCount, 0) + assert.strictEqual(handleFocusSpy.callCount, 0) wrapper.find('.unit-input').simulate('click') - assert.equal(handleFocusSpy.callCount, 1) + assert.strictEqual(handleFocusSpy.callCount, 1) }) it('should call onChange on input changes with the value', function () { const wrapper = mount() assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) const input = wrapper.find('input') input.simulate('change', { target: { value: 123 } }) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith(123)) - assert.equal(wrapper.state('value'), 123) + assert.strictEqual(wrapper.state('value'), 123) }) it('should set the component state value with props.value', function () { const wrapper = mount() assert.ok(wrapper) - assert.equal(wrapper.state('value'), 123) + assert.strictEqual(wrapper.state('value'), 123) }) it('should update the component state value with props.value', function () { const wrapper = mount() assert.ok(wrapper) - assert.equal(handleChangeSpy.callCount, 0) + assert.strictEqual(handleChangeSpy.callCount, 0) const input = wrapper.find('input') input.simulate('change', { target: { value: 123 } }) - assert.equal(wrapper.state('value'), 123) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(wrapper.state('value'), 123) + assert.strictEqual(handleChangeSpy.callCount, 1) assert.ok(handleChangeSpy.calledWith(123)) wrapper.setProps({ value: 456 }) - assert.equal(wrapper.state('value'), 456) - assert.equal(handleChangeSpy.callCount, 1) + assert.strictEqual(wrapper.state('value'), 456) + assert.strictEqual(handleChangeSpy.callCount, 1) }) }) }) diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js index 4d2d56544..f5edaa67f 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js @@ -83,11 +83,14 @@ describe('Confirm Transaction Duck', function () { } it('should initialize state', function () { - assert.deepEqual(ConfirmTransactionReducer(undefined, {}), initialState) + assert.deepStrictEqual( + ConfirmTransactionReducer(undefined, {}), + initialState, + ) }) it('should return state unchanged if it does not match a dispatched actions type', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: 'someOtherAction', value: 'someValue', @@ -97,7 +100,7 @@ describe('Confirm Transaction Duck', function () { }) it('should set txData when receiving a UPDATE_TX_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TX_DATA, payload: { @@ -115,7 +118,7 @@ describe('Confirm Transaction Duck', function () { }) it('should clear txData when receiving a CLEAR_TX_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: CLEAR_TX_DATA, }), @@ -127,7 +130,7 @@ describe('Confirm Transaction Duck', function () { }) it('should set tokenData when receiving a UPDATE_TOKEN_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TOKEN_DATA, payload: { @@ -145,7 +148,7 @@ describe('Confirm Transaction Duck', function () { }) it('should clear tokenData when receiving a CLEAR_TOKEN_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: CLEAR_TOKEN_DATA, }), @@ -157,7 +160,7 @@ describe('Confirm Transaction Duck', function () { }) it('should set methodData when receiving a UPDATE_METHOD_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_METHOD_DATA, payload: { @@ -175,7 +178,7 @@ describe('Confirm Transaction Duck', function () { }) it('should clear methodData when receiving a CLEAR_METHOD_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: CLEAR_METHOD_DATA, }), @@ -187,7 +190,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update transaction amounts when receiving an UPDATE_TRANSACTION_AMOUNTS action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TRANSACTION_AMOUNTS, payload: { @@ -206,7 +209,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update transaction fees when receiving an UPDATE_TRANSACTION_FEES action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TRANSACTION_FEES, payload: { @@ -225,7 +228,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update transaction totals when receiving an UPDATE_TRANSACTION_TOTALS action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TRANSACTION_TOTALS, payload: { @@ -244,7 +247,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update tokenProps when receiving an UPDATE_TOKEN_PROPS action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TOKEN_PROPS, payload: { @@ -263,7 +266,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update nonce when receiving an UPDATE_NONCE action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_NONCE, payload: '0x1', @@ -276,7 +279,7 @@ describe('Confirm Transaction Duck', function () { }) it('should update nonce when receiving an UPDATE_TO_SMART_CONTRACT action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: UPDATE_TO_SMART_CONTRACT, payload: true, @@ -289,7 +292,7 @@ describe('Confirm Transaction Duck', function () { }) it('should set fetchingData to true when receiving a FETCH_DATA_START action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: FETCH_DATA_START, }), @@ -301,7 +304,7 @@ describe('Confirm Transaction Duck', function () { }) it('should set fetchingData to false when receiving a FETCH_DATA_END action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer( { fetchingData: true }, { type: FETCH_DATA_END }, @@ -311,7 +314,7 @@ describe('Confirm Transaction Duck', function () { }) it('should clear confirmTransaction when receiving a FETCH_DATA_END action', function () { - assert.deepEqual( + assert.deepStrictEqual( ConfirmTransactionReducer(mockState, { type: CLEAR_CONFIRM_TRANSACTION, }), @@ -328,7 +331,7 @@ describe('Confirm Transaction Duck', function () { payload: txData, } - assert.deepEqual(actions.updateTxData(txData), expectedAction) + assert.deepStrictEqual(actions.updateTxData(txData), expectedAction) }) it('should create an action to clear txData', function () { @@ -336,7 +339,7 @@ describe('Confirm Transaction Duck', function () { type: CLEAR_TX_DATA, } - assert.deepEqual(actions.clearTxData(), expectedAction) + assert.deepStrictEqual(actions.clearTxData(), expectedAction) }) it('should create an action to update tokenData', function () { @@ -346,7 +349,7 @@ describe('Confirm Transaction Duck', function () { payload: tokenData, } - assert.deepEqual(actions.updateTokenData(tokenData), expectedAction) + assert.deepStrictEqual(actions.updateTokenData(tokenData), expectedAction) }) it('should create an action to clear tokenData', function () { @@ -354,7 +357,7 @@ describe('Confirm Transaction Duck', function () { type: CLEAR_TOKEN_DATA, } - assert.deepEqual(actions.clearTokenData(), expectedAction) + assert.deepStrictEqual(actions.clearTokenData(), expectedAction) }) it('should create an action to update methodData', function () { @@ -364,7 +367,10 @@ describe('Confirm Transaction Duck', function () { payload: methodData, } - assert.deepEqual(actions.updateMethodData(methodData), expectedAction) + assert.deepStrictEqual( + actions.updateMethodData(methodData), + expectedAction, + ) }) it('should create an action to clear methodData', function () { @@ -372,7 +378,7 @@ describe('Confirm Transaction Duck', function () { type: CLEAR_METHOD_DATA, } - assert.deepEqual(actions.clearMethodData(), expectedAction) + assert.deepStrictEqual(actions.clearMethodData(), expectedAction) }) it('should create an action to update transaction amounts', function () { @@ -382,7 +388,7 @@ describe('Confirm Transaction Duck', function () { payload: transactionAmounts, } - assert.deepEqual( + assert.deepStrictEqual( actions.updateTransactionAmounts(transactionAmounts), expectedAction, ) @@ -395,7 +401,7 @@ describe('Confirm Transaction Duck', function () { payload: transactionFees, } - assert.deepEqual( + assert.deepStrictEqual( actions.updateTransactionFees(transactionFees), expectedAction, ) @@ -408,7 +414,7 @@ describe('Confirm Transaction Duck', function () { payload: transactionTotals, } - assert.deepEqual( + assert.deepStrictEqual( actions.updateTransactionTotals(transactionTotals), expectedAction, ) @@ -424,7 +430,10 @@ describe('Confirm Transaction Duck', function () { payload: tokenProps, } - assert.deepEqual(actions.updateTokenProps(tokenProps), expectedAction) + assert.deepStrictEqual( + actions.updateTokenProps(tokenProps), + expectedAction, + ) }) it('should create an action to update nonce', function () { @@ -434,7 +443,7 @@ describe('Confirm Transaction Duck', function () { payload: nonce, } - assert.deepEqual(actions.updateNonce(nonce), expectedAction) + assert.deepStrictEqual(actions.updateNonce(nonce), expectedAction) }) it('should create an action to set fetchingData to true', function () { @@ -442,7 +451,7 @@ describe('Confirm Transaction Duck', function () { type: FETCH_DATA_START, } - assert.deepEqual(actions.setFetchingData(true), expectedAction) + assert.deepStrictEqual(actions.setFetchingData(true), expectedAction) }) it('should create an action to set fetchingData to false', function () { @@ -450,7 +459,7 @@ describe('Confirm Transaction Duck', function () { type: FETCH_DATA_END, } - assert.deepEqual(actions.setFetchingData(false), expectedAction) + assert.deepStrictEqual(actions.setFetchingData(false), expectedAction) }) it('should create an action to clear confirmTransaction', function () { @@ -458,7 +467,7 @@ describe('Confirm Transaction Duck', function () { type: CLEAR_CONFIRM_TRANSACTION, } - assert.deepEqual(actions.clearConfirmTransaction(), expectedAction) + assert.deepStrictEqual(actions.clearConfirmTransaction(), expectedAction) }) }) @@ -526,9 +535,9 @@ describe('Confirm Transaction Duck', function () { ) const storeActions = store.getActions() - assert.equal(storeActions.length, expectedActions.length) + assert.strictEqual(storeActions.length, expectedActions.length) storeActions.forEach((action, index) => - assert.equal(action.type, expectedActions[index]), + assert.strictEqual(action.type, expectedActions[index]), ) }) @@ -592,9 +601,9 @@ describe('Confirm Transaction Duck', function () { store.dispatch(actions.updateTxDataAndCalculate(txData)) const storeActions = store.getActions() - assert.equal(storeActions.length, expectedActions.length) + assert.strictEqual(storeActions.length, expectedActions.length) storeActions.forEach((action, index) => - assert.equal(action.type, expectedActions[index]), + assert.strictEqual(action.type, expectedActions[index]), ) }) @@ -638,10 +647,10 @@ describe('Confirm Transaction Duck', function () { store.dispatch(actions.setTransactionToConfirm(2603411941761054)) const storeActions = store.getActions() - assert.equal(storeActions.length, expectedActions.length) + assert.strictEqual(storeActions.length, expectedActions.length) storeActions.forEach((action, index) => - assert.equal(action.type, expectedActions[index]), + assert.strictEqual(action.type, expectedActions[index]), ) }) }) diff --git a/ui/app/ducks/gas/gas-duck.test.js b/ui/app/ducks/gas/gas-duck.test.js index b9935af5c..aceea5efb 100644 --- a/ui/app/ducks/gas/gas-duck.test.js +++ b/ui/app/ducks/gas/gas-duck.test.js @@ -86,11 +86,11 @@ describe('Gas Duck', function () { describe('GasReducer()', function () { it('should initialize state', function () { - assert.deepEqual(GasReducer(undefined, {}), initState) + assert.deepStrictEqual(GasReducer(undefined, {}), initState) }) it('should return state unchanged if it does not match a dispatched actions type', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: 'someOtherAction', value: 'someValue', @@ -100,21 +100,21 @@ describe('Gas Duck', function () { }) it('should set basicEstimateIsLoading to true when receiving a BASIC_GAS_ESTIMATE_LOADING_STARTED action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: BASIC_GAS_ESTIMATE_LOADING_STARTED }), { basicEstimateIsLoading: true, ...mockState }, ) }) it('should set basicEstimateIsLoading to false when receiving a BASIC_GAS_ESTIMATE_LOADING_FINISHED action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }), { basicEstimateIsLoading: false, ...mockState }, ) }) it('should set basicEstimates when receiving a SET_BASIC_GAS_ESTIMATE_DATA action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: SET_BASIC_GAS_ESTIMATE_DATA, value: { someProp: 'someData123' }, @@ -124,7 +124,7 @@ describe('Gas Duck', function () { }) it('should set customData.price when receiving a SET_CUSTOM_GAS_PRICE action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: SET_CUSTOM_GAS_PRICE, value: 4321, @@ -134,7 +134,7 @@ describe('Gas Duck', function () { }) it('should set customData.limit when receiving a SET_CUSTOM_GAS_LIMIT action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: SET_CUSTOM_GAS_LIMIT, value: 9876, @@ -144,7 +144,7 @@ describe('Gas Duck', function () { }) it('should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: SET_CUSTOM_GAS_TOTAL, value: 10000, @@ -154,7 +154,7 @@ describe('Gas Duck', function () { }) it('should set errors when receiving a SET_CUSTOM_GAS_ERRORS action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: SET_CUSTOM_GAS_ERRORS, value: { someError: 'error_error' }, @@ -164,7 +164,7 @@ describe('Gas Duck', function () { }) it('should return the initial state in response to a RESET_CUSTOM_GAS_STATE action', function () { - assert.deepEqual( + assert.deepStrictEqual( GasReducer(mockState, { type: RESET_CUSTOM_GAS_STATE }), initState, ) @@ -173,7 +173,7 @@ describe('Gas Duck', function () { describe('basicGasEstimatesLoadingStarted', function () { it('should create the correct action', function () { - assert.deepEqual(basicGasEstimatesLoadingStarted(), { + assert.deepStrictEqual(basicGasEstimatesLoadingStarted(), { type: BASIC_GAS_ESTIMATE_LOADING_STARTED, }) }) @@ -181,7 +181,7 @@ describe('Gas Duck', function () { describe('basicGasEstimatesLoadingFinished', function () { it('should create the correct action', function () { - assert.deepEqual(basicGasEstimatesLoadingFinished(), { + assert.deepStrictEqual(basicGasEstimatesLoadingFinished(), { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED, }) }) @@ -194,7 +194,7 @@ describe('Gas Duck', function () { await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: { ...initState, basicPriceAEstimatesLastRetrieved: 1000000 }, })) - assert.deepEqual(mockDistpatch.getCall(0).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(0).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, ]) assert.ok( @@ -203,10 +203,10 @@ describe('Gas Duck', function () { .args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'), 'should fetch metaswap /gasPrices', ) - assert.deepEqual(mockDistpatch.getCall(1).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(1).args, [ { type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 }, ]) - assert.deepEqual(mockDistpatch.getCall(2).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(2).args, [ { type: SET_BASIC_GAS_ESTIMATE_DATA, value: { @@ -216,7 +216,7 @@ describe('Gas Duck', function () { }, }, ]) - assert.deepEqual(mockDistpatch.getCall(3).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(3).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }, ]) }) @@ -235,11 +235,11 @@ describe('Gas Duck', function () { await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: { ...initState }, })) - assert.deepEqual(mockDistpatch.getCall(0).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(0).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, ]) assert.ok(window.fetch.notCalled) - assert.deepEqual(mockDistpatch.getCall(1).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(1).args, [ { type: SET_BASIC_GAS_ESTIMATE_DATA, value: { @@ -249,7 +249,7 @@ describe('Gas Duck', function () { }, }, ]) - assert.deepEqual(mockDistpatch.getCall(2).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(2).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }, ]) }) @@ -263,7 +263,7 @@ describe('Gas Duck', function () { await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: { ...initState }, })) - assert.deepEqual(mockDistpatch.getCall(0).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(0).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, ]) assert.ok( @@ -272,10 +272,10 @@ describe('Gas Duck', function () { .args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'), 'should fetch metaswap /gasPrices', ) - assert.deepEqual(mockDistpatch.getCall(1).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(1).args, [ { type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 }, ]) - assert.deepEqual(mockDistpatch.getCall(2).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(2).args, [ { type: SET_BASIC_GAS_ESTIMATE_DATA, value: { @@ -285,7 +285,7 @@ describe('Gas Duck', function () { }, }, ]) - assert.deepEqual(mockDistpatch.getCall(3).args, [ + assert.deepStrictEqual(mockDistpatch.getCall(3).args, [ { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }, ]) }) @@ -293,7 +293,7 @@ describe('Gas Duck', function () { describe('setBasicGasEstimateData', function () { it('should create the correct action', function () { - assert.deepEqual(setBasicGasEstimateData('mockBasicEstimatData'), { + assert.deepStrictEqual(setBasicGasEstimateData('mockBasicEstimatData'), { type: SET_BASIC_GAS_ESTIMATE_DATA, value: 'mockBasicEstimatData', }) @@ -302,7 +302,7 @@ describe('Gas Duck', function () { describe('setCustomGasPrice', function () { it('should create the correct action', function () { - assert.deepEqual(setCustomGasPrice('mockCustomGasPrice'), { + assert.deepStrictEqual(setCustomGasPrice('mockCustomGasPrice'), { type: SET_CUSTOM_GAS_PRICE, value: 'mockCustomGasPrice', }) @@ -311,7 +311,7 @@ describe('Gas Duck', function () { describe('setCustomGasLimit', function () { it('should create the correct action', function () { - assert.deepEqual(setCustomGasLimit('mockCustomGasLimit'), { + assert.deepStrictEqual(setCustomGasLimit('mockCustomGasLimit'), { type: SET_CUSTOM_GAS_LIMIT, value: 'mockCustomGasLimit', }) @@ -320,7 +320,7 @@ describe('Gas Duck', function () { describe('setCustomGasTotal', function () { it('should create the correct action', function () { - assert.deepEqual(setCustomGasTotal('mockCustomGasTotal'), { + assert.deepStrictEqual(setCustomGasTotal('mockCustomGasTotal'), { type: SET_CUSTOM_GAS_TOTAL, value: 'mockCustomGasTotal', }) @@ -329,7 +329,7 @@ describe('Gas Duck', function () { describe('setCustomGasErrors', function () { it('should create the correct action', function () { - assert.deepEqual(setCustomGasErrors('mockErrorObject'), { + assert.deepStrictEqual(setCustomGasErrors('mockErrorObject'), { type: SET_CUSTOM_GAS_ERRORS, value: 'mockErrorObject', }) @@ -338,7 +338,9 @@ describe('Gas Duck', function () { describe('resetCustomGasState', function () { it('should create the correct action', function () { - assert.deepEqual(resetCustomGasState(), { type: RESET_CUSTOM_GAS_STATE }) + assert.deepStrictEqual(resetCustomGasState(), { + type: RESET_CUSTOM_GAS_STATE, + }) }) }) }) diff --git a/ui/app/ducks/send/send-duck.test.js b/ui/app/ducks/send/send-duck.test.js index 3c7ca415a..2d123fb01 100644 --- a/ui/app/ducks/send/send-duck.test.js +++ b/ui/app/ducks/send/send-duck.test.js @@ -26,11 +26,11 @@ describe('Send Duck', function () { describe('SendReducer()', function () { it('should initialize state', function () { - assert.deepEqual(SendReducer(undefined, {}), initState) + assert.deepStrictEqual(SendReducer(undefined, {}), initState) }) it('should return state unchanged if it does not match a dispatched actions type', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer(mockState, { type: 'someOtherAction', value: 'someValue', @@ -40,7 +40,7 @@ describe('Send Duck', function () { }) it('should set toDropdownOpen to true when receiving a OPEN_TO_DROPDOWN action', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer(mockState, { type: OPEN_TO_DROPDOWN, }), @@ -49,7 +49,7 @@ describe('Send Duck', function () { }) it('should set toDropdownOpen to false when receiving a CLOSE_TO_DROPDOWN action', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer(mockState, { type: CLOSE_TO_DROPDOWN, }), @@ -58,7 +58,7 @@ describe('Send Duck', function () { }) it('should set gasButtonGroupShown to true when receiving a SHOW_GAS_BUTTON_GROUP action', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer( { ...mockState, gasButtonGroupShown: false }, { type: SHOW_GAS_BUTTON_GROUP }, @@ -68,7 +68,7 @@ describe('Send Duck', function () { }) it('should set gasButtonGroupShown to false when receiving a HIDE_GAS_BUTTON_GROUP action', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer(mockState, { type: HIDE_GAS_BUTTON_GROUP }), { gasButtonGroupShown: false, ...mockState }, ) @@ -81,7 +81,7 @@ describe('Send Duck', function () { someError: false, }, } - assert.deepEqual( + assert.deepStrictEqual( SendReducer(modifiedMockState, { type: UPDATE_SEND_ERRORS, value: { someOtherError: true }, @@ -97,7 +97,7 @@ describe('Send Duck', function () { }) it('should return the initial state in response to a RESET_SEND_STATE action', function () { - assert.deepEqual( + assert.deepStrictEqual( SendReducer(mockState, { type: RESET_SEND_STATE, }), @@ -107,23 +107,27 @@ describe('Send Duck', function () { }) describe('openToDropdown', function () { - assert.deepEqual(openToDropdown(), { type: OPEN_TO_DROPDOWN }) + assert.deepStrictEqual(openToDropdown(), { type: OPEN_TO_DROPDOWN }) }) describe('closeToDropdown', function () { - assert.deepEqual(closeToDropdown(), { type: CLOSE_TO_DROPDOWN }) + assert.deepStrictEqual(closeToDropdown(), { type: CLOSE_TO_DROPDOWN }) }) describe('showGasButtonGroup', function () { - assert.deepEqual(showGasButtonGroup(), { type: SHOW_GAS_BUTTON_GROUP }) + assert.deepStrictEqual(showGasButtonGroup(), { + type: SHOW_GAS_BUTTON_GROUP, + }) }) describe('hideGasButtonGroup', function () { - assert.deepEqual(hideGasButtonGroup(), { type: HIDE_GAS_BUTTON_GROUP }) + assert.deepStrictEqual(hideGasButtonGroup(), { + type: HIDE_GAS_BUTTON_GROUP, + }) }) describe('updateSendErrors', function () { - assert.deepEqual(updateSendErrors('mockErrorObject'), { + assert.deepStrictEqual(updateSendErrors('mockErrorObject'), { type: UPDATE_SEND_ERRORS, value: 'mockErrorObject', }) diff --git a/ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js b/ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js index df1b20cb4..06f95129a 100644 --- a/ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js +++ b/ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js @@ -27,12 +27,12 @@ describe('withModalProps', function () { assert.ok(wrapper) const testComponent = wrapper.find(TestComponent).at(0) - assert.equal(testComponent.length, 1) - assert.equal(testComponent.find('.test').text(), 'Testing') + assert.strictEqual(testComponent.length, 1) + assert.strictEqual(testComponent.find('.test').text(), 'Testing') const testComponentProps = testComponent.props() - assert.equal(testComponentProps.prop1, 'prop1') - assert.equal(testComponentProps.prop2, 2) - assert.equal(testComponentProps.prop3, true) - assert.equal(typeof testComponentProps.hideModal, 'function') + assert.strictEqual(testComponentProps.prop1, 'prop1') + assert.strictEqual(testComponentProps.prop2, 2) + assert.strictEqual(testComponentProps.prop3, true) + assert.strictEqual(typeof testComponentProps.hideModal, 'function') }) }) diff --git a/ui/app/helpers/utils/common.util.test.js b/ui/app/helpers/utils/common.util.test.js index cd2d71b03..2e083322d 100644 --- a/ui/app/helpers/utils/common.util.test.js +++ b/ui/app/helpers/utils/common.util.test.js @@ -20,7 +20,7 @@ describe('Common utils', function () { ] tests.forEach(({ test, expected }) => { - assert.equal(utils.camelCaseToCapitalize(test), expected) + assert.strictEqual(utils.camelCaseToCapitalize(test), expected) }) }) }) diff --git a/ui/app/helpers/utils/confirm-tx.util.test.js b/ui/app/helpers/utils/confirm-tx.util.test.js index 0db49ef89..a05090648 100644 --- a/ui/app/helpers/utils/confirm-tx.util.test.js +++ b/ui/app/helpers/utils/confirm-tx.util.test.js @@ -5,43 +5,43 @@ describe('Confirm Transaction utils', function () { describe('increaseLastGasPrice', function () { it('should increase the gasPrice by 10%', function () { const increasedGasPrice = utils.increaseLastGasPrice('0xa') - assert.equal(increasedGasPrice, '0xb') + assert.strictEqual(increasedGasPrice, '0xb') }) it('should prefix the result with 0x', function () { const increasedGasPrice = utils.increaseLastGasPrice('a') - assert.equal(increasedGasPrice, '0xb') + assert.strictEqual(increasedGasPrice, '0xb') }) }) describe('hexGreaterThan', function () { it('should return true if the first value is greater than the second value', function () { - assert.equal(utils.hexGreaterThan('0xb', '0xa'), true) + assert.strictEqual(utils.hexGreaterThan('0xb', '0xa'), true) }) it('should return false if the first value is less than the second value', function () { - assert.equal(utils.hexGreaterThan('0xa', '0xb'), false) + assert.strictEqual(utils.hexGreaterThan('0xa', '0xb'), false) }) it('should return false if the first value is equal to the second value', function () { - assert.equal(utils.hexGreaterThan('0xa', '0xa'), false) + assert.strictEqual(utils.hexGreaterThan('0xa', '0xa'), false) }) it('should correctly compare prefixed and non-prefixed hex values', function () { - assert.equal(utils.hexGreaterThan('0xb', 'a'), true) + assert.strictEqual(utils.hexGreaterThan('0xb', 'a'), true) }) }) describe('getHexGasTotal', function () { it('should multiply the hex gasLimit and hex gasPrice values together', function () { - assert.equal( + assert.strictEqual( utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }), '0x1319718a5000', ) }) it('should prefix the result with 0x', function () { - assert.equal( + assert.strictEqual( utils.getHexGasTotal({ gasLimit: '5208', gasPrice: '3b9aca00' }), '0x1319718a5000', ) @@ -50,11 +50,11 @@ describe('Confirm Transaction utils', function () { describe('addEth', function () { it('should add two values together rounding to 6 decimal places', function () { - assert.equal(utils.addEth('0.12345678', '0'), '0.123457') + assert.strictEqual(utils.addEth('0.12345678', '0'), '0.123457') }) it('should add any number of values together rounding to 6 decimal places', function () { - assert.equal( + assert.strictEqual( utils.addEth( '0.1', '0.02', @@ -71,11 +71,11 @@ describe('Confirm Transaction utils', function () { describe('addFiat', function () { it('should add two values together rounding to 2 decimal places', function () { - assert.equal(utils.addFiat('0.12345678', '0'), '0.12') + assert.strictEqual(utils.addFiat('0.12345678', '0'), '0.12') }) it('should add any number of values together rounding to 2 decimal places', function () { - assert.equal( + assert.strictEqual( utils.addFiat( '0.1', '0.02', @@ -99,7 +99,7 @@ describe('Confirm Transaction utils', function () { numberOfDecimals: 6, }) - assert.equal(ethTransactionAmount, '1') + assert.strictEqual(ethTransactionAmount, '1') }) it('should get the transaction amount in fiat', function () { @@ -110,7 +110,7 @@ describe('Confirm Transaction utils', function () { numberOfDecimals: 2, }) - assert.equal(fiatTransactionAmount, '468.58') + assert.strictEqual(fiatTransactionAmount, '468.58') }) }) @@ -123,7 +123,7 @@ describe('Confirm Transaction utils', function () { numberOfDecimals: 6, }) - assert.equal(ethTransactionFee, '0.000021') + assert.strictEqual(ethTransactionFee, '0.000021') }) it('should get the transaction fee in fiat', function () { @@ -134,14 +134,14 @@ describe('Confirm Transaction utils', function () { numberOfDecimals: 2, }) - assert.equal(fiatTransactionFee, '0.01') + assert.strictEqual(fiatTransactionFee, '0.01') }) }) describe('formatCurrency', function () { it('should format USD values', function () { const value = utils.formatCurrency('123.45', 'usd') - assert.equal(value, '$123.45') + assert.strictEqual(value, '$123.45') }) }) }) diff --git a/ui/app/helpers/utils/conversion-util.test.js b/ui/app/helpers/utils/conversion-util.test.js index 34a7a5308..5e05f6727 100644 --- a/ui/app/helpers/utils/conversion-util.test.js +++ b/ui/app/helpers/utils/conversion-util.test.js @@ -9,7 +9,7 @@ describe('conversion utils', function () { aBase: 10, bBase: 10, }) - assert.equal(result.toNumber(), 12) + assert.strictEqual(result.toNumber(), 12) }) it('add decimals', function () { @@ -17,7 +17,7 @@ describe('conversion utils', function () { aBase: 10, bBase: 10, }) - assert.equal(result.toNumber(), 3.2) + assert.strictEqual(result.toNumber(), 3.2) }) it('add repeating decimals', function () { @@ -25,7 +25,7 @@ describe('conversion utils', function () { aBase: 10, bBase: 10, }) - assert.equal(result.toNumber(), 0.4444444444444444) + assert.strictEqual(result.toNumber(), 0.4444444444444444) }) }) @@ -47,14 +47,14 @@ describe('conversion utils', function () { assert(conv2 instanceof BigNumber, 'conversion 2 should be a BigNumber') }) it('Converts from dec to hex', function () { - assert.equal( + assert.strictEqual( conversionUtil('1000000000000000000', { fromNumericBase: 'dec', toNumericBase: 'hex', }), 'de0b6b3a7640000', ) - assert.equal( + assert.strictEqual( conversionUtil('1500000000000000000', { fromNumericBase: 'dec', toNumericBase: 'hex', @@ -63,79 +63,79 @@ describe('conversion utils', function () { ) }) it('Converts hex formatted numbers to dec', function () { - assert.equal( + assert.strictEqual( conversionUtil('0xde0b6b3a7640000', { fromNumericBase: 'hex', toNumericBase: 'dec', }), - 1000000000000000000, + '1000000000000000000', ) - assert.equal( + assert.strictEqual( conversionUtil('0x14d1120d7b160000', { fromNumericBase: 'hex', toNumericBase: 'dec', }), - 1500000000000000000, + '1500000000000000000', ) }) it('Converts WEI to ETH', function () { - assert.equal( + assert.strictEqual( conversionUtil('0xde0b6b3a7640000', { fromNumericBase: 'hex', toNumericBase: 'dec', fromDenomination: 'WEI', toDenomination: 'ETH', }), - 1, + '1', ) - assert.equal( + assert.strictEqual( conversionUtil('0x14d1120d7b160000', { fromNumericBase: 'hex', toNumericBase: 'dec', fromDenomination: 'WEI', toDenomination: 'ETH', }), - 1.5, + '1.5', ) }) it('Converts ETH to WEI', function () { - assert.equal( + assert.strictEqual( conversionUtil('1', { fromNumericBase: 'dec', fromDenomination: 'ETH', toDenomination: 'WEI', - }), + }).toNumber(), 1000000000000000000, ) - assert.equal( + assert.strictEqual( conversionUtil('1.5', { fromNumericBase: 'dec', fromDenomination: 'ETH', toDenomination: 'WEI', - }), + }).toNumber(), 1500000000000000000, ) }) it('Converts ETH to GWEI', function () { - assert.equal( + assert.strictEqual( conversionUtil('1', { fromNumericBase: 'dec', fromDenomination: 'ETH', toDenomination: 'GWEI', - }), + }).toNumber(), 1000000000, ) - assert.equal( + assert.strictEqual( conversionUtil('1.5', { fromNumericBase: 'dec', fromDenomination: 'ETH', toDenomination: 'GWEI', - }), + }).toNumber(), 1500000000, ) }) it('Converts ETH to USD', function () { - assert.equal( + assert.strictEqual( conversionUtil('1', { fromNumericBase: 'dec', toNumericBase: 'dec', @@ -143,9 +143,9 @@ describe('conversion utils', function () { conversionRate: 468.58, numberOfDecimals: 2, }), - 468.58, + '468.58', ) - assert.equal( + assert.strictEqual( conversionUtil('1.5', { fromNumericBase: 'dec', toNumericBase: 'dec', @@ -153,11 +153,11 @@ describe('conversion utils', function () { conversionRate: 468.58, numberOfDecimals: 2, }), - 702.87, + '702.87', ) }) it('Converts USD to ETH', function () { - assert.equal( + assert.strictEqual( conversionUtil('468.58', { fromNumericBase: 'dec', toNumericBase: 'dec', @@ -166,9 +166,9 @@ describe('conversion utils', function () { numberOfDecimals: 2, invertConversionRate: true, }), - 1, + '1', ) - assert.equal( + assert.strictEqual( conversionUtil('702.87', { fromNumericBase: 'dec', toNumericBase: 'dec', @@ -177,7 +177,7 @@ describe('conversion utils', function () { numberOfDecimals: 2, invertConversionRate: true, }), - 1.5, + '1.5', ) }) }) diff --git a/ui/app/helpers/utils/conversions.util.test.js b/ui/app/helpers/utils/conversions.util.test.js index 5a32ceff4..6ae58ca83 100644 --- a/ui/app/helpers/utils/conversions.util.test.js +++ b/ui/app/helpers/utils/conversions.util.test.js @@ -10,34 +10,34 @@ describe('conversion utils', function () { fromCurrency: ETH, fromDenomination: ETH, }) - assert.equal(weiValue, '0') + assert.strictEqual(weiValue, '0') }) }) describe('decETHToDecWEI', function () { it('should correctly convert 1 ETH to WEI', function () { const weiValue = utils.decETHToDecWEI('1') - assert.equal(weiValue, '1000000000000000000') + assert.strictEqual(weiValue, '1000000000000000000') }) it('should correctly convert 0.000000000000000001 ETH to WEI', function () { const weiValue = utils.decETHToDecWEI('0.000000000000000001') - assert.equal(weiValue, '1') + assert.strictEqual(weiValue, '1') }) it('should correctly convert 1000000.000000000000000001 ETH to WEI', function () { const weiValue = utils.decETHToDecWEI('1000000.000000000000000001') - assert.equal(weiValue, '1000000000000000000000001') + assert.strictEqual(weiValue, '1000000000000000000000001') }) it('should correctly convert 9876.543210 ETH to WEI', function () { const weiValue = utils.decETHToDecWEI('9876.543210') - assert.equal(weiValue, '9876543210000000000000') + assert.strictEqual(weiValue, '9876543210000000000000') }) it('should correctly convert 1.0000000000000000 ETH to WEI', function () { const weiValue = utils.decETHToDecWEI('1.0000000000000000') - assert.equal(weiValue, '1000000000000000000') + assert.strictEqual(weiValue, '1000000000000000000') }) }) }) diff --git a/ui/app/helpers/utils/fetch-with-cache.test.js b/ui/app/helpers/utils/fetch-with-cache.test.js index c0fcda3fc..43336a85e 100644 --- a/ui/app/helpers/utils/fetch-with-cache.test.js +++ b/ui/app/helpers/utils/fetch-with-cache.test.js @@ -26,7 +26,7 @@ describe('Fetch with cache', function () { const response = await fetchWithCache( 'https://fetchwithcache.metamask.io/price', ) - assert.deepEqual(response, { + assert.deepStrictEqual(response, { average: 1, }) }) @@ -46,7 +46,7 @@ describe('Fetch with cache', function () { const response = await fetchWithCache( 'https://fetchwithcache.metamask.io/price', ) - assert.deepEqual(response, { + assert.deepStrictEqual(response, { average: 1, }) }) @@ -68,7 +68,7 @@ describe('Fetch with cache', function () { {}, { cacheRefreshTime: 123 }, ) - assert.deepEqual(response, { + assert.deepStrictEqual(response, { average: 3, }) }) diff --git a/ui/app/helpers/utils/i18n-helper.test.js b/ui/app/helpers/utils/i18n-helper.test.js index 3c0cca220..1c908f7f3 100644 --- a/ui/app/helpers/utils/i18n-helper.test.js +++ b/ui/app/helpers/utils/i18n-helper.test.js @@ -100,12 +100,12 @@ describe('i18n helper', function () { describe('getMessage', function () { it('should return the exact message paired with key if there are no substitutions', function () { const result = t(TEST_KEY_1) - assert.equal(result, 'This is a simple message.') + assert.strictEqual(result, 'This is a simple message.') }) it('should return the correct message when a single non-react substitution is made', function () { const result = t(TEST_KEY_2, [TEST_SUBSTITUTION_1]) - assert.equal( + assert.strictEqual( result, `This is a message with a single non-react substitution ${TEST_SUBSTITUTION_1}.`, ) @@ -113,7 +113,7 @@ describe('i18n helper', function () { it('should return the correct message when two non-react substitutions are made', function () { const result = t(TEST_KEY_3, [TEST_SUBSTITUTION_1, TEST_SUBSTITUTION_2]) - assert.equal( + assert.strictEqual( result, `This is a message with two non-react substitutions ${TEST_SUBSTITUTION_1} and ${TEST_SUBSTITUTION_2}.`, ) @@ -127,7 +127,7 @@ describe('i18n helper', function () { TEST_SUBSTITUTION_4, TEST_SUBSTITUTION_5, ]) - assert.equal( + assert.strictEqual( result, `${TEST_SUBSTITUTION_1} - ${TEST_SUBSTITUTION_2} - ${TEST_SUBSTITUTION_3} - ${TEST_SUBSTITUTION_4} - ${TEST_SUBSTITUTION_5}`, ) @@ -135,17 +135,17 @@ describe('i18n helper', function () { it('should correctly render falsey substitutions', function () { const result = t(TEST_KEY_4, [0, -0, '', false, NaN]) - assert.equal(result, '0 - 0 - - false - NaN') + assert.strictEqual(result, '0 - 0 - - false - NaN') }) it('should render nothing for "null" and "undefined" substitutions', function () { const result = t(TEST_KEY_5, [null, TEST_SUBSTITUTION_2]) - assert.equal(result, ` - ${TEST_SUBSTITUTION_2} - `) + assert.strictEqual(result, ` - ${TEST_SUBSTITUTION_2} - `) }) it('should return the correct message when a single react substitution is made', function () { const result = t(TEST_KEY_6, [TEST_SUBSTITUTION_6]) - assert.equal( + assert.strictEqual( shallow(result).html(), ' Testing a react substitution
TEST_SUBSTITUTION_1
.
', ) @@ -156,7 +156,7 @@ describe('i18n helper', function () { TEST_SUBSTITUTION_7_1, TEST_SUBSTITUTION_7_2, ]) - assert.equal( + assert.strictEqual( shallow(result).html(), ' Testing a react substitution
TEST_SUBSTITUTION_1
and another
TEST_SUBSTITUTION_2
.
', ) @@ -169,7 +169,7 @@ describe('i18n helper', function () { TEST_SUBSTITUTION_2, TEST_SUBSTITUTION_8_2, ]) - assert.equal( + assert.strictEqual( shallow(result).html(), ' Testing a mix TEST_SUBSTITUTION_1 of react substitutions
TEST_SUBSTITUTION_3
and string substitutions TEST_SUBSTITUTION_2 +
TEST_SUBSTITUTION_4
.
', ) diff --git a/ui/app/helpers/utils/transactions.util.test.js b/ui/app/helpers/utils/transactions.util.test.js index 80de38846..9079028dd 100644 --- a/ui/app/helpers/utils/transactions.util.test.js +++ b/ui/app/helpers/utils/transactions.util.test.js @@ -14,11 +14,11 @@ describe('Transactions utils', function () { ) assert.ok(tokenData) const { name, args } = tokenData - assert.equal(name, TRANSACTION_CATEGORIES.TOKEN_METHOD_TRANSFER) + assert.strictEqual(name, TRANSACTION_CATEGORIES.TOKEN_METHOD_TRANSFER) const to = args._to const value = args._value.toString() - assert.equal(to, '0x50A9D56C2B8BA9A5c7f2C08C3d26E0499F23a706') - assert.equal(value, '20000') + assert.strictEqual(to, '0x50A9D56C2B8BA9A5c7f2C08C3d26E0499F23a706') + assert.strictEqual(value, '20000') }) it('should not throw errors when called without arguments', function () { @@ -56,7 +56,7 @@ describe('Transactions utils', function () { ] tests.forEach(({ transaction, expected }) => { - assert.equal(utils.getStatusKey(transaction), expected) + assert.strictEqual(utils.getStatusKey(transaction), expected) }) }) }) @@ -96,7 +96,7 @@ describe('Transactions utils', function () { ] tests.forEach(({ expected, networkId, hash, rpcPrefs }) => { - assert.equal( + assert.strictEqual( utils.getBlockExplorerUrlForTx(networkId, hash, rpcPrefs), expected, ) diff --git a/ui/app/helpers/utils/util.test.js b/ui/app/helpers/utils/util.test.js index 15c8e722f..9f319c362 100644 --- a/ui/app/helpers/utils/util.test.js +++ b/ui/app/helpers/utils/util.test.js @@ -12,25 +12,25 @@ describe('util', function () { it('should render 0.01 eth correctly', function () { const input = '0x2386F26FC10000' const output = util.parseBalance(input) - assert.deepEqual(output, ['0', '01']) + assert.deepStrictEqual(output, ['0', '01']) }) it('should render 12.023 eth correctly', function () { const input = 'A6DA46CCA6858000' const output = util.parseBalance(input) - assert.deepEqual(output, ['12', '023']) + assert.deepStrictEqual(output, ['12', '023']) }) it('should render 0.0000000342422 eth correctly', function () { const input = '0x7F8FE81C0' const output = util.parseBalance(input) - assert.deepEqual(output, ['0', '0000000342422']) + assert.deepStrictEqual(output, ['0', '0000000342422']) }) it('should render 0 eth correctly', function () { const input = '0x0' const output = util.parseBalance(input) - assert.deepEqual(output, ['0', '0']) + assert.deepStrictEqual(output, ['0', '0']) }) }) @@ -38,13 +38,13 @@ describe('util', function () { it('should add case-sensitive checksum', function () { const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825' const result = util.addressSummary(address) - assert.equal(result, '0xFDEa65C8...b825') + assert.strictEqual(result, '0xFDEa65C8...b825') }) it('should accept arguments for firstseg, lastseg, and keepPrefix', function () { const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825' const result = util.addressSummary(address, 4, 4, false) - assert.equal(result, 'FDEa...b825') + assert.strictEqual(result, 'FDEa...b825') }) }) @@ -89,7 +89,7 @@ describe('util', function () { const address = '0x5Fda30Bb72B8Dfe20e48A00dFc108d0915BE9Bb0' const result = util.isValidAddress(address) const hashed = ethUtil.toChecksumAddress(address.toLowerCase()) - assert.equal(hashed, address, 'example is hashed correctly') + assert.strictEqual(hashed, address, 'example is hashed correctly') assert.ok(result, 'is valid by our check') }) }) @@ -155,30 +155,30 @@ describe('util', function () { describe('#numericBalance', function () { it('should return a BN 0 if given nothing', function () { const result = util.numericBalance() - assert.equal(result.toString(10), 0) + assert.strictEqual(result.toString(10), '0') }) it('should work with hex prefix', function () { const result = util.numericBalance('0x012') - assert.equal(result.toString(10), '18') + assert.strictEqual(result.toString(10), '18') }) it('should work with no hex prefix', function () { const result = util.numericBalance('012') - assert.equal(result.toString(10), '18') + assert.strictEqual(result.toString(10), '18') }) }) describe('#formatBalance', function () { it('should return None when given nothing', function () { const result = util.formatBalance() - assert.equal(result, 'None', 'should return "None"') + assert.strictEqual(result, 'None', 'should return "None"') }) it('should return 1.0000 ETH', function () { const input = new ethUtil.BN(ethInWei, 10).toJSON() const result = util.formatBalance(input, 4) - assert.equal(result, '1.0000 ETH') + assert.strictEqual(result, '1.0000 ETH') }) it('should return 0.500 ETH', function () { @@ -186,29 +186,29 @@ describe('util', function () { .div(new ethUtil.BN('2', 10)) .toJSON() const result = util.formatBalance(input, 3) - assert.equal(result, '0.500 ETH') + assert.strictEqual(result, '0.500 ETH') }) it('should display specified decimal points', function () { const input = '0x128dfa6a90b28000' const result = util.formatBalance(input, 2) - assert.equal(result, '1.33 ETH') + assert.strictEqual(result, '1.33 ETH') }) it('should default to 3 decimal points', function () { const input = '0x128dfa6a90b28000' const result = util.formatBalance(input) - assert.equal(result, '1.337 ETH') + assert.strictEqual(result, '1.337 ETH') }) it('should show 2 significant digits for tiny balances', function () { const input = '0x1230fa6a90b28' const result = util.formatBalance(input) - assert.equal(result, '0.00032 ETH') + assert.strictEqual(result, '0.00032 ETH') }) it('should not parse the balance and return value with 2 decimal points with ETH at the end', function () { const value = '1.2456789' const needsParse = false const result = util.formatBalance(value, 2, needsParse) - assert.equal(result, '1.24 ETH') + assert.strictEqual(result, '1.24 ETH') }) }) @@ -235,7 +235,7 @@ describe('util', function () { Object.keys(valueTable).forEach((currency) => { const value = new ethUtil.BN(valueTable[currency], 10) const output = util.normalizeToWei(value, currency) - assert.equal( + assert.strictEqual( output.toString(10), valueTable.wei, `value of ${output.toString( @@ -250,25 +250,25 @@ describe('util', function () { it('should convert decimal eth to pure wei BN', function () { const input = '1.23456789' const output = util.normalizeEthStringToWei(input) - assert.equal(output.toString(10), '1234567890000000000') + assert.strictEqual(output.toString(10), '1234567890000000000') }) it('should convert 1 to expected wei', function () { const input = '1' const output = util.normalizeEthStringToWei(input) - assert.equal(output.toString(10), ethInWei) + assert.strictEqual(output.toString(10), ethInWei) }) it('should account for overflow numbers gracefully by dropping extra precision.', function () { const input = '1.11111111111111111111' const output = util.normalizeEthStringToWei(input) - assert.equal(output.toString(10), '1111111111111111111') + assert.strictEqual(output.toString(10), '1111111111111111111') }) it('should not truncate very exact wei values that do not have extra precision.', function () { const input = '1.100000000000000001' const output = util.normalizeEthStringToWei(input) - assert.equal(output.toString(10), '1100000000000000001') + assert.strictEqual(output.toString(10), '1100000000000000001') }) }) @@ -277,17 +277,17 @@ describe('util', function () { const input = 0.0002 const output = util.normalizeNumberToWei(input, 'ether') const str = output.toString(10) - assert.equal(str, '200000000000000') + assert.strictEqual(str, '200000000000000') }) it('should convert a kwei number to the appropriate equivalent wei', function () { const result = util.normalizeNumberToWei(1.111, 'kwei') - assert.equal(result.toString(10), '1111', 'accepts decimals') + assert.strictEqual(result.toString(10), '1111', 'accepts decimals') }) it('should convert a ether number to the appropriate equivalent wei', function () { const result = util.normalizeNumberToWei(1.111, 'ether') - assert.equal( + assert.strictEqual( result.toString(10), '1111000000000000000', 'accepts decimals', @@ -408,14 +408,17 @@ describe('util', function () { testData.forEach(({ args, result }) => { it(`should return ${result} when passed number ${args[0]} and precision ${args[1]}`, function () { - assert.equal(util.toPrecisionWithoutTrailingZeros(...args), result) + assert.strictEqual( + util.toPrecisionWithoutTrailingZeros(...args), + result, + ) }) }) }) describe('addHexPrefixToObjectValues()', function () { it('should return a new object with the same properties with a 0x prefix', function () { - assert.deepEqual( + assert.deepStrictEqual( util.addHexPrefixToObjectValues({ prop1: '0x123', prop2: '456', diff --git a/ui/app/hooks/tests/useCancelTransaction.test.js b/ui/app/hooks/tests/useCancelTransaction.test.js index 903e861d0..0d3d590f3 100644 --- a/ui/app/hooks/tests/useCancelTransaction.test.js +++ b/ui/app/hooks/tests/useCancelTransaction.test.js @@ -44,18 +44,18 @@ describe('useCancelTransaction', function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup), ) - assert.equal(result.current[0], false) + assert.strictEqual(result.current[0], false) }) it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup), ) - assert.equal(typeof result.current[1], 'function') + assert.strictEqual(typeof result.current[1], 'function') result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined, }) - assert.equal( + assert.strictEqual( dispatch.calledWith( showModal({ name: 'CANCEL_TRANSACTION', @@ -96,18 +96,18 @@ describe('useCancelTransaction', function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup), ) - assert.equal(result.current[0], true) + assert.strictEqual(result.current[0], true) }) it(`should return a function that kicks off cancellation for id ${transactionId}`, function () { const { result } = renderHook(() => useCancelTransaction(transactionGroup), ) - assert.equal(typeof result.current[1], 'function') + assert.strictEqual(typeof result.current[1], 'function') result.current[1]({ preventDefault: () => undefined, stopPropagation: () => undefined, }) - assert.equal( + assert.strictEqual( dispatch.calledWith( showModal({ name: 'CANCEL_TRANSACTION', diff --git a/ui/app/hooks/tests/useCurrencyDisplay.test.js b/ui/app/hooks/tests/useCurrencyDisplay.test.js index bacaa6ff0..4b90e9a79 100644 --- a/ui/app/hooks/tests/useCurrencyDisplay.test.js +++ b/ui/app/hooks/tests/useCurrencyDisplay.test.js @@ -117,13 +117,13 @@ describe('useCurrencyDisplay', function () { const [displayValue, parts] = hookReturn.result.current stub.restore() it(`should return ${result.displayValue} as displayValue`, function () { - assert.equal(displayValue, result.displayValue) + assert.strictEqual(displayValue, result.displayValue) }) it(`should return ${result.value} as value`, function () { - assert.equal(parts.value, result.value) + assert.strictEqual(parts.value, result.value) }) it(`should return ${result.suffix} as suffix`, function () { - assert.equal(parts.suffix, result.suffix) + assert.strictEqual(parts.suffix, result.suffix) }) }) }) diff --git a/ui/app/hooks/tests/useRetryTransaction.test.js b/ui/app/hooks/tests/useRetryTransaction.test.js index 30f62ed56..91d99026d 100644 --- a/ui/app/hooks/tests/useRetryTransaction.test.js +++ b/ui/app/hooks/tests/useRetryTransaction.test.js @@ -43,7 +43,7 @@ describe('useRetryTransaction', function () { ) const retry = result.current retry(event) - assert.equal(trackEvent.calledOnce, true) + assert.strictEqual(trackEvent.calledOnce, true) }) it('retryTransaction function should show retry sidebar', async function () { @@ -52,7 +52,7 @@ describe('useRetryTransaction', function () { ) const retry = result.current await retry(event) - assert.equal( + assert.strictEqual( dispatch.calledWith( showSidebar({ transitionName: 'sidebar-left', diff --git a/ui/app/hooks/tests/useTokenData.test.js b/ui/app/hooks/tests/useTokenData.test.js index 373c84eb5..ec473300d 100644 --- a/ui/app/hooks/tests/useTokenData.test.js +++ b/ui/app/hooks/tests/useTokenData.test.js @@ -53,14 +53,14 @@ describe('useTokenData', function () { it(testTitle, function () { const { result } = renderHook(() => useTokenData(test.data)) if (test.tokenData) { - assert.equal(result.current.name, test.tokenData.name) - assert.equal( + assert.strictEqual(result.current.name, test.tokenData.name) + assert.strictEqual( result.current.args[0].toLowerCase(), test.tokenData.args[0], ) assert.ok(test.tokenData.args[1].eq(result.current.args[1])) } else { - assert.equal(result.current, test.tokenData) + assert.strictEqual(result.current, test.tokenData) } }) }) diff --git a/ui/app/hooks/tests/useTokenDisplayValue.test.js b/ui/app/hooks/tests/useTokenDisplayValue.test.js index e9ba328bd..bc77bd6c7 100644 --- a/ui/app/hooks/tests/useTokenDisplayValue.test.js +++ b/ui/app/hooks/tests/useTokenDisplayValue.test.js @@ -130,7 +130,7 @@ describe('useTokenDisplayValue', function () { useTokenDisplayValue(`${idx}-fakestring`, test.token), ) sinon.restore() - assert.equal(result.current, test.displayValue) + assert.strictEqual(result.current, test.displayValue) }) }) }) diff --git a/ui/app/hooks/tests/useTransactionDisplayData.test.js b/ui/app/hooks/tests/useTransactionDisplayData.test.js index cb7784620..00b2f5bb8 100644 --- a/ui/app/hooks/tests/useTransactionDisplayData.test.js +++ b/ui/app/hooks/tests/useTransactionDisplayData.test.js @@ -178,35 +178,38 @@ describe('useTransactionDisplayData', function () { () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.title, expected.title) + assert.strictEqual(result.current.title, expected.title) }) it(`should return a subtitle of ${expected.subtitle}`, function () { const { result } = renderHookWithRouter( () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.subtitle, expected.subtitle) + assert.strictEqual(result.current.subtitle, expected.subtitle) }) it(`should return a category of ${expected.category}`, function () { const { result } = renderHookWithRouter( () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.category, expected.category) + assert.strictEqual(result.current.category, expected.category) }) it(`should return a primaryCurrency of ${expected.primaryCurrency}`, function () { const { result } = renderHookWithRouter( () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.primaryCurrency, expected.primaryCurrency) + assert.strictEqual( + result.current.primaryCurrency, + expected.primaryCurrency, + ) }) it(`should return a secondaryCurrency of ${expected.secondaryCurrency}`, function () { const { result } = renderHookWithRouter( () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal( + assert.strictEqual( result.current.secondaryCurrency, expected.secondaryCurrency, ) @@ -216,7 +219,7 @@ describe('useTransactionDisplayData', function () { () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal( + assert.strictEqual( result.current.displayedStatusKey, expected.displayedStatusKey, ) @@ -226,14 +229,17 @@ describe('useTransactionDisplayData', function () { () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.recipientAddress, expected.recipientAddress) + assert.strictEqual( + result.current.recipientAddress, + expected.recipientAddress, + ) }) it(`should return a senderAddress of ${expected.senderAddress}`, function () { const { result } = renderHookWithRouter( () => useTransactionDisplayData(transactionGroup), tokenAddress, ) - assert.equal(result.current.senderAddress, expected.senderAddress) + assert.strictEqual(result.current.senderAddress, expected.senderAddress) }) }) }) @@ -241,7 +247,7 @@ describe('useTransactionDisplayData', function () { const { result } = renderHookWithRouter(() => useTransactionDisplayData(transactions[0]), ) - assert.deepEqual(result.current, expectedResults[0]) + assert.deepStrictEqual(result.current, expectedResults[0]) }) after(function () { useSelector.restore() diff --git a/ui/app/hooks/tests/useUserPreferencedCurrency.test.js b/ui/app/hooks/tests/useUserPreferencedCurrency.test.js index 0b5534fdb..0386e6ec4 100644 --- a/ui/app/hooks/tests/useUserPreferencedCurrency.test.js +++ b/ui/app/hooks/tests/useUserPreferencedCurrency.test.js @@ -135,12 +135,12 @@ describe('useUserPreferencedCurrency', function () { it(`should return currency as ${ result.currency || 'not modified by user preferences' }`, function () { - assert.equal(hookResult.current.currency, result.currency) + assert.strictEqual(hookResult.current.currency, result.currency) }) it(`should return decimals as ${ result.numberOfDecimals || 'not modified by user preferences' }`, function () { - assert.equal( + assert.strictEqual( hookResult.current.numberOfDecimals, result.numberOfDecimals, ) diff --git a/ui/app/pages/add-token/tests/add-token.test.js b/ui/app/pages/add-token/tests/add-token.test.js index 300a6b019..697724dd7 100644 --- a/ui/app/pages/add-token/tests/add-token.test.js +++ b/ui/app/pages/add-token/tests/add-token.test.js @@ -49,7 +49,7 @@ describe('Add Token', function () { '.button.btn-secondary.page-container__footer-button', ) - assert.equal(nextButton.props().disabled, true) + assert.strictEqual(nextButton.props().disabled, true) }) it('edits token address', function () { @@ -58,7 +58,7 @@ describe('Add Token', function () { const customAddress = wrapper.find('input#custom-address') customAddress.simulate('change', event) - assert.equal( + assert.strictEqual( wrapper.find('AddToken').instance().state.customAddress, tokenAddress, ) @@ -70,7 +70,7 @@ describe('Add Token', function () { const customAddress = wrapper.find('#custom-symbol') customAddress.last().simulate('change', event) - assert.equal( + assert.strictEqual( wrapper.find('AddToken').instance().state.customSymbol, tokenSymbol, ) @@ -82,7 +82,7 @@ describe('Add Token', function () { const customAddress = wrapper.find('#custom-decimals') customAddress.last().simulate('change', event) - assert.equal( + assert.strictEqual( wrapper.find('AddToken').instance().state.customDecimals, tokenPrecision, ) @@ -96,7 +96,10 @@ describe('Add Token', function () { assert(props.setPendingTokens.calledOnce) assert(props.history.push.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/confirm-add-token') + assert.strictEqual( + props.history.push.getCall(0).args[0], + '/confirm-add-token', + ) }) it('cancels', function () { @@ -106,7 +109,7 @@ describe('Add Token', function () { cancelButton.simulate('click') assert(props.clearPendingTokens.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/') + assert.strictEqual(props.history.push.getCall(0).args[0], '/') }) }) }) diff --git a/ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.component.test.js b/ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.component.test.js index 3add429b6..96ddc2ff4 100644 --- a/ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.component.test.js +++ b/ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.component.test.js @@ -4,11 +4,11 @@ import { getMethodName } from '../confirm-transaction-base.component' describe('ConfirmTransactionBase Component', function () { describe('getMethodName', function () { it('should get correct method names', function () { - assert.equal(getMethodName(undefined), '') - assert.equal(getMethodName({}), '') - assert.equal(getMethodName('confirm'), 'confirm') - assert.equal(getMethodName('balanceOf'), 'balance Of') - assert.equal( + assert.strictEqual(getMethodName(undefined), '') + assert.strictEqual(getMethodName({}), '') + assert.strictEqual(getMethodName('confirm'), 'confirm') + assert.strictEqual(getMethodName('balanceOf'), 'balance Of') + assert.strictEqual( getMethodName('ethToTokenSwapInput'), 'eth To Token Swap Input', ) diff --git a/ui/app/pages/create-account/tests/create-account.test.js b/ui/app/pages/create-account/tests/create-account.test.js index a99ffa47f..335d3c5ba 100644 --- a/ui/app/pages/create-account/tests/create-account.test.js +++ b/ui/app/pages/create-account/tests/create-account.test.js @@ -27,18 +27,24 @@ describe('Create Account Page', function () { it('clicks create account and routes to new-account path', function () { const createAccount = wrapper.find('.new-account__tabs__tab').at(0) createAccount.simulate('click') - assert.equal(props.history.push.getCall(0).args[0], '/new-account') + assert.strictEqual(props.history.push.getCall(0).args[0], '/new-account') }) it('clicks import account and routes to import new account path', function () { const importAccount = wrapper.find('.new-account__tabs__tab').at(1) importAccount.simulate('click') - assert.equal(props.history.push.getCall(0).args[0], '/new-account/import') + assert.strictEqual( + props.history.push.getCall(0).args[0], + '/new-account/import', + ) }) it('clicks connect HD Wallet and routes to connect new account path', function () { const connectHdWallet = wrapper.find('.new-account__tabs__tab').at(2) connectHdWallet.simulate('click') - assert.equal(props.history.push.getCall(0).args[0], '/new-account/connect') + assert.strictEqual( + props.history.push.getCall(0).args[0], + '/new-account/connect', + ) }) }) diff --git a/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/tests/import-with-seed-phrase.component.test.js b/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/tests/import-with-seed-phrase.component.test.js index 2ec3b97dc..7aea35494 100644 --- a/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/tests/import-with-seed-phrase.component.test.js +++ b/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/tests/import-with-seed-phrase.component.test.js @@ -20,7 +20,7 @@ describe('ImportWithSeedPhrase Component', function () { onSubmit: sinon.spy(), }) const textareaCount = root.find('.first-time-flow__textarea').length - assert.equal(textareaCount, 1, 'should render 12 seed phrases') + assert.strictEqual(textareaCount, 1, 'should render 12 seed phrases') }) describe('parseSeedPhrase', function () { @@ -31,7 +31,7 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase('foo bar baz'), 'foo bar baz') + assert.deepStrictEqual(parseSeedPhrase('foo bar baz'), 'foo bar baz') }) it('should handle a mixed-case seed phrase', function () { @@ -41,7 +41,7 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase('FOO bAr baZ'), 'foo bar baz') + assert.deepStrictEqual(parseSeedPhrase('FOO bAr baZ'), 'foo bar baz') }) it('should handle an upper-case seed phrase', function () { @@ -51,7 +51,7 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase('FOO BAR BAZ'), 'foo bar baz') + assert.deepStrictEqual(parseSeedPhrase('FOO BAR BAZ'), 'foo bar baz') }) it('should trim extraneous whitespace from the given seed phrase', function () { @@ -61,7 +61,10 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase(' foo bar baz '), 'foo bar baz') + assert.deepStrictEqual( + parseSeedPhrase(' foo bar baz '), + 'foo bar baz', + ) }) it('should return an empty string when given a whitespace-only string', function () { @@ -71,7 +74,7 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase(' '), '') + assert.deepStrictEqual(parseSeedPhrase(' '), '') }) it('should return an empty string when given a string with only symbols', function () { @@ -81,7 +84,7 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase('$'), '') + assert.deepStrictEqual(parseSeedPhrase('$'), '') }) it('should return an empty string for both null and undefined', function () { @@ -91,8 +94,8 @@ describe('ImportWithSeedPhrase Component', function () { const { parseSeedPhrase } = root.instance() - assert.deepEqual(parseSeedPhrase(undefined), '') - assert.deepEqual(parseSeedPhrase(null), '') + assert.deepStrictEqual(parseSeedPhrase(undefined), '') + assert.deepStrictEqual(parseSeedPhrase(null), '') }) }) }) diff --git a/ui/app/pages/first-time-flow/end-of-flow/tests/end-of-flow.test.js b/ui/app/pages/first-time-flow/end-of-flow/tests/end-of-flow.test.js index ad7b0e7e1..aef4ef6a1 100644 --- a/ui/app/pages/first-time-flow/end-of-flow/tests/end-of-flow.test.js +++ b/ui/app/pages/first-time-flow/end-of-flow/tests/end-of-flow.test.js @@ -20,7 +20,7 @@ describe('End of Flow Screen', function () { }) it('renders', function () { - assert.equal(wrapper.length, 1) + assert.strictEqual(wrapper.length, 1) }) it('should navigate to the default route on click', function (done) { diff --git a/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js b/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js index 3ec0d1a61..fa3b9788f 100644 --- a/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js +++ b/ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js @@ -21,7 +21,7 @@ describe('FirstTimeFlowSwitch', function () { const wrapper = mountWithRouter( , ) - assert.equal( + assert.strictEqual( wrapper .find('Lifecycle') .find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length, @@ -37,7 +37,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper.find('Lifecycle').find({ to: { pathname: DEFAULT_ROUTE } }) .length, 1, @@ -53,7 +53,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper .find('Lifecycle') .find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length, @@ -70,7 +70,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper .find('Lifecycle') .find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length, @@ -89,7 +89,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper.find('Lifecycle').find({ to: { pathname: LOCK_ROUTE } }).length, 1, ) @@ -107,7 +107,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper .find('Lifecycle') .find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length, @@ -127,7 +127,7 @@ describe('FirstTimeFlowSwitch', function () { , ) - assert.equal( + assert.strictEqual( wrapper .find('Lifecycle') .find({ to: { pathname: INITIALIZE_UNLOCK_ROUTE } }).length, diff --git a/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js b/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js index 1c0950516..f0e561a4b 100644 --- a/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js +++ b/ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js @@ -30,18 +30,18 @@ describe('Reveal Seed Phrase', function () { it('seed phrase', function () { const seedPhrase = wrapper.find('.reveal-seed-phrase__secret-words--hidden') - assert.equal(seedPhrase.length, 1) - assert.equal(seedPhrase.text(), TEST_SEED) + assert.strictEqual(seedPhrase.length, 1) + assert.strictEqual(seedPhrase.text(), TEST_SEED) }) it('clicks to reveal', function () { const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker') - assert.equal(wrapper.state().isShowingSeedPhrase, false) + assert.strictEqual(wrapper.state().isShowingSeedPhrase, false) reveal.simulate('click') - assert.equal(wrapper.state().isShowingSeedPhrase, true) + assert.strictEqual(wrapper.state().isShowingSeedPhrase, true) const showSeed = wrapper.find('.reveal-seed-phrase__secret-words') - assert.equal(showSeed.length, 1) + assert.strictEqual(showSeed.length, 1) }) }) diff --git a/ui/app/pages/first-time-flow/seed-phrase/tests/confirm-seed-phrase-component.test.js b/ui/app/pages/first-time-flow/seed-phrase/tests/confirm-seed-phrase-component.test.js index a5a0d1c91..1be3b70d7 100644 --- a/ui/app/pages/first-time-flow/seed-phrase/tests/confirm-seed-phrase-component.test.js +++ b/ui/app/pages/first-time-flow/seed-phrase/tests/confirm-seed-phrase-component.test.js @@ -19,7 +19,7 @@ describe('ConfirmSeedPhrase Component', function () { seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬', }) - assert.equal( + assert.strictEqual( root.find('.confirm-seed-phrase__seed-word--sorted').length, 12, 'should render 12 seed phrases', @@ -46,7 +46,7 @@ describe('ConfirmSeedPhrase Component', function () { seeds.at(1).simulate('click') seeds.at(2).simulate('click') - assert.deepEqual( + assert.deepStrictEqual( root.state().selectedSeedIndices, [0, 1, 2], 'should add seed phrase to selected on click', @@ -57,7 +57,7 @@ describe('ConfirmSeedPhrase Component', function () { root.update() root.state() root.find('.confirm-seed-phrase__seed-word--sorted').at(1).simulate('click') - assert.deepEqual( + assert.deepStrictEqual( root.state().selectedSeedIndices, [0, 2], 'should remove seed phrase from selected when click again', @@ -94,9 +94,9 @@ describe('ConfirmSeedPhrase Component', function () { '.confirm-seed-phrase__selected-seed-words__pending-seed', ) - assert.equal(pendingSeeds.at(0).props().seedIndex, 2) - assert.equal(pendingSeeds.at(1).props().seedIndex, 0) - assert.equal(pendingSeeds.at(2).props().seedIndex, 1) + assert.strictEqual(pendingSeeds.at(0).props().seedIndex, 2) + assert.strictEqual(pendingSeeds.at(1).props().seedIndex, 0) + assert.strictEqual(pendingSeeds.at(2).props().seedIndex, 1) }) it('should insert seed in place on drop', function () { @@ -126,8 +126,8 @@ describe('ConfirmSeedPhrase Component', function () { root.update() - assert.deepEqual(root.state().selectedSeedIndices, [2, 0, 1]) - assert.deepEqual(root.state().pendingSeedIndices, [2, 0, 1]) + assert.deepStrictEqual(root.state().selectedSeedIndices, [2, 0, 1]) + assert.deepStrictEqual(root.state().pendingSeedIndices, [2, 0, 1]) }) it('should submit correctly', async function () { @@ -174,7 +174,7 @@ describe('ConfirmSeedPhrase Component', function () { await new Promise((resolve) => setTimeout(resolve, 100)) - assert.deepEqual(metricsEventSpy.args[0][0], { + assert.deepStrictEqual(metricsEventSpy.args[0][0], { eventOpts: { category: 'Onboarding', action: 'Seed Phrase Setup', @@ -182,6 +182,6 @@ describe('ConfirmSeedPhrase Component', function () { }, }) assert(initialize3BoxSpy.calledOnce) - assert.equal(pushSpy.args[0][0], '/initialize/end-of-flow') + assert.strictEqual(pushSpy.args[0][0], '/initialize/end-of-flow') }) }) diff --git a/ui/app/pages/first-time-flow/select-action/tests/select-action.test.js b/ui/app/pages/first-time-flow/select-action/tests/select-action.test.js index d8abdd135..447c20602 100644 --- a/ui/app/pages/first-time-flow/select-action/tests/select-action.test.js +++ b/ui/app/pages/first-time-flow/select-action/tests/select-action.test.js @@ -31,7 +31,7 @@ describe('Selection Action', function () { importWalletButton.simulate('click') assert(props.setFirstTimeFlowType.calledOnce) - assert.equal(props.setFirstTimeFlowType.getCall(0).args[0], 'import') + assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'import') assert(props.history.push.calledOnce) }) @@ -42,7 +42,7 @@ describe('Selection Action', function () { createWalletButton.simulate('click') assert(props.setFirstTimeFlowType.calledOnce) - assert.equal(props.setFirstTimeFlowType.getCall(0).args[0], 'create') + assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'create') assert(props.history.push.calledOnce) }) }) diff --git a/ui/app/pages/first-time-flow/welcome/tests/welcome.test.js b/ui/app/pages/first-time-flow/welcome/tests/welcome.test.js index 67df69c14..4c35d8c0d 100644 --- a/ui/app/pages/first-time-flow/welcome/tests/welcome.test.js +++ b/ui/app/pages/first-time-flow/welcome/tests/welcome.test.js @@ -32,7 +32,7 @@ describe('Welcome', function () { '.btn-primary.first-time-flow__button', ) getStartedButton.simulate('click') - assert.equal( + assert.strictEqual( props.history.push.getCall(0).args[0], '/initialize/select-action', ) @@ -56,7 +56,7 @@ describe('Welcome', function () { '.btn-primary.first-time-flow__button', ) getStartedButton.simulate('click') - assert.equal( + assert.strictEqual( props.history.push.getCall(0).args[0], '/initialize/create-password', ) diff --git a/ui/app/pages/lock/tests/lock.test.js b/ui/app/pages/lock/tests/lock.test.js index 92a46af6e..688fe062a 100644 --- a/ui/app/pages/lock/tests/lock.test.js +++ b/ui/app/pages/lock/tests/lock.test.js @@ -15,7 +15,7 @@ describe('Lock', function () { mountWithRouter() - assert.equal(props.history.replace.getCall(0).args[0], '/') + assert.strictEqual(props.history.replace.getCall(0).args[0], '/') }) it('locks and pushes history with default route when isUnlocked true', function (done) { @@ -33,7 +33,7 @@ describe('Lock', function () { assert(props.lockMetamask.calledOnce) setImmediate(() => { - assert.equal(props.history.push.getCall(0).args[0], '/') + assert.strictEqual(props.history.push.getCall(0).args[0], '/') done() }) }) diff --git a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-component.test.js b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-component.test.js index 40f3b6a9c..fddaf3da7 100644 --- a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-component.test.js +++ b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-component.test.js @@ -68,25 +68,28 @@ describe('AddRecipient Component', function () { describe('selectRecipient', function () { it('should call updateSendTo', function () { - assert.equal(propsMethodSpies.updateSendTo.callCount, 0) + assert.strictEqual(propsMethodSpies.updateSendTo.callCount, 0) instance.selectRecipient('mockTo2', 'mockNickname') - assert.equal(propsMethodSpies.updateSendTo.callCount, 1) - assert.deepEqual(propsMethodSpies.updateSendTo.getCall(0).args, [ + assert.strictEqual(propsMethodSpies.updateSendTo.callCount, 1) + assert.deepStrictEqual(propsMethodSpies.updateSendTo.getCall(0).args, [ 'mockTo2', 'mockNickname', ]) }) it('should call updateGas if there is no to error', function () { - assert.equal(propsMethodSpies.updateGas.callCount, 0) + assert.strictEqual(propsMethodSpies.updateGas.callCount, 0) instance.selectRecipient(false) - assert.equal(propsMethodSpies.updateGas.callCount, 1) + assert.strictEqual(propsMethodSpies.updateGas.callCount, 1) }) }) describe('render', function () { it('should render a component', function () { - assert.equal(wrapper.find('.send__select-recipient-wrapper').length, 1) + assert.strictEqual( + wrapper.find('.send__select-recipient-wrapper').length, + 1, + ) }) it('should render no content if there are no recents, transfers, and contacts', function () { @@ -95,11 +98,11 @@ describe('AddRecipient Component', function () { addressBook: [], }) - assert.equal( + assert.strictEqual( wrapper.find('.send__select-recipient-wrapper__list__link').length, 0, ) - assert.equal( + assert.strictEqual( wrapper.find('.send__select-recipient-wrapper__group').length, 0, ) @@ -118,10 +121,10 @@ describe('AddRecipient Component', function () { const xferLink = wrapper.find( '.send__select-recipient-wrapper__list__link', ) - assert.equal(xferLink.length, 1) + assert.strictEqual(xferLink.length, 1) const groups = wrapper.find('RecipientGroup') - assert.equal( + assert.strictEqual( groups.shallow().find('.send__select-recipient-wrapper__group').length, 1, ) @@ -138,7 +141,7 @@ describe('AddRecipient Component', function () { const contactList = wrapper.find('ContactList') - assert.equal(contactList.length, 1) + assert.strictEqual(contactList.length, 1) }) it('should render contacts', function () { @@ -154,12 +157,12 @@ describe('AddRecipient Component', function () { const xferLink = wrapper.find( '.send__select-recipient-wrapper__list__link', ) - assert.equal(xferLink.length, 0) + assert.strictEqual(xferLink.length, 0) const groups = wrapper.find('ContactList') - assert.equal(groups.length, 1) + assert.strictEqual(groups.length, 1) - assert.equal( + assert.strictEqual( groups.find('.send__select-recipient-wrapper__group-item').length, 0, ) @@ -175,9 +178,9 @@ describe('AddRecipient Component', function () { const dialog = wrapper.find(Dialog) - assert.equal(dialog.props().type, 'error') - assert.equal(dialog.props().children, 'bad_t') - assert.equal(dialog.length, 1) + assert.strictEqual(dialog.props().type, 'error') + assert.strictEqual(dialog.props().children, 'bad_t') + assert.strictEqual(dialog.length, 1) }) it('should render error when query has ens does not resolve', function () { @@ -191,9 +194,9 @@ describe('AddRecipient Component', function () { const dialog = wrapper.find(Dialog) - assert.equal(dialog.props().type, 'error') - assert.equal(dialog.props().children, 'very bad') - assert.equal(dialog.length, 1) + assert.strictEqual(dialog.props().type, 'error') + assert.strictEqual(dialog.props().children, 'very bad') + assert.strictEqual(dialog.length, 1) }) it('should not render error when ens resolved', function () { @@ -205,7 +208,7 @@ describe('AddRecipient Component', function () { const dialog = wrapper.find(Dialog) - assert.equal(dialog.length, 0) + assert.strictEqual(dialog.length, 0) }) it('should not render error when query has results', function () { @@ -220,7 +223,7 @@ describe('AddRecipient Component', function () { const dialog = wrapper.find(Dialog) - assert.equal(dialog.length, 0) + assert.strictEqual(dialog.length, 0) }) }) }) diff --git a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-container.test.js b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-container.test.js index b7502bf52..f488b2f4e 100644 --- a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-container.test.js +++ b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-container.test.js @@ -33,7 +33,7 @@ proxyquire('../add-recipient.container.js', { describe('add-recipient container', function () { describe('mapStateToProps()', function () { it('should map the correct properties to props', function () { - assert.deepEqual(mapStateToProps('mockState'), { + assert.deepStrictEqual(mapStateToProps('mockState'), { addressBook: [{ name: 'mockAddressBook:mockState' }], contacts: [{ name: 'mockAddressBook:mockState' }], ensResolution: 'mockSendEnsResolution:mockState', @@ -57,7 +57,7 @@ describe('add-recipient container', function () { mapDispatchToPropsObject.updateSendTo('mockTo', 'mockNickname') assert(dispatchSpy.calledOnce) assert(actionSpies.updateSendTo.calledOnce) - assert.deepEqual(actionSpies.updateSendTo.getCall(0).args, [ + assert.deepStrictEqual(actionSpies.updateSendTo.getCall(0).args, [ 'mockTo', 'mockNickname', ]) diff --git a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-utils.test.js b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-utils.test.js index e0972b36c..bfd83cbd7 100644 --- a/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-utils.test.js +++ b/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-utils.test.js @@ -24,25 +24,25 @@ const { getToErrorObject, getToWarningObject } = toRowUtils describe('add-recipient utils', function () { describe('getToErrorObject()', function () { it('should return a required error if "to" is falsy', function () { - assert.deepEqual(getToErrorObject(null), { + assert.deepStrictEqual(getToErrorObject(null), { to: REQUIRED_ERROR, }) }) it('should return null if "to" is falsy and hexData is truthy', function () { - assert.deepEqual(getToErrorObject(null, true), { + assert.deepStrictEqual(getToErrorObject(null, true), { to: null, }) }) it('should return an invalid recipient error if "to" is truthy but invalid', function () { - assert.deepEqual(getToErrorObject('mockInvalidTo'), { + assert.deepStrictEqual(getToErrorObject('mockInvalidTo'), { to: INVALID_RECIPIENT_ADDRESS_ERROR, }) }) it('should return null if "to" is truthy and valid', function () { - assert.deepEqual(getToErrorObject('0xabc123'), { + assert.deepStrictEqual(getToErrorObject('0xabc123'), { to: null, }) }) @@ -50,7 +50,7 @@ describe('add-recipient utils', function () { describe('getToWarningObject()', function () { it('should return a known address recipient error if "to" is a token address', function () { - assert.deepEqual( + assert.deepStrictEqual( getToWarningObject('0xabc123', [{ address: '0xabc123' }], { address: '0xabc123', }), @@ -61,7 +61,7 @@ describe('add-recipient utils', function () { }) it('should null if "to" is a token address but sendToken is falsy', function () { - assert.deepEqual( + assert.deepStrictEqual( getToWarningObject('0xabc123', [{ address: '0xabc123' }]), { to: null, @@ -70,7 +70,7 @@ describe('add-recipient utils', function () { }) it('should return a known address recipient error if "to" is part of contract metadata', function () { - assert.deepEqual( + assert.deepStrictEqual( getToWarningObject( '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [{ address: '0xabc123' }], @@ -82,7 +82,7 @@ describe('add-recipient utils', function () { ) }) it('should null if "to" is part of contract metadata but sendToken is falsy', function () { - assert.deepEqual( + assert.deepStrictEqual( getToWarningObject( '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', [{ address: '0xabc123' }], diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js index f56aa6e12..fb040de64 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js @@ -52,10 +52,10 @@ describe('AmountMaxButton Component', function () { describe('setMaxAmount', function () { it('should call setAmountToMax with the correct params', function () { - assert.equal(propsMethodSpies.setAmountToMax.callCount, 0) + assert.strictEqual(propsMethodSpies.setAmountToMax.callCount, 0) instance.setMaxAmount() - assert.equal(propsMethodSpies.setAmountToMax.callCount, 1) - assert.deepEqual(propsMethodSpies.setAmountToMax.getCall(0).args, [ + assert.strictEqual(propsMethodSpies.setAmountToMax.callCount, 1) + assert.deepStrictEqual(propsMethodSpies.setAmountToMax.getCall(0).args, [ { balance: 'mockBalance', gasTotal: 'mockGasTotal', @@ -74,17 +74,19 @@ describe('AmountMaxButton Component', function () { it('should call setMaxModeTo and setMaxAmount when the checkbox is checked', function () { const { onClick } = wrapper.find('.send-v2__amount-max').props() - assert.equal(AmountMaxButton.prototype.setMaxAmount.callCount, 0) - assert.equal(propsMethodSpies.setMaxModeTo.callCount, 0) + assert.strictEqual(AmountMaxButton.prototype.setMaxAmount.callCount, 0) + assert.strictEqual(propsMethodSpies.setMaxModeTo.callCount, 0) onClick(MOCK_EVENT) - assert.equal(AmountMaxButton.prototype.setMaxAmount.callCount, 1) - assert.equal(propsMethodSpies.setMaxModeTo.callCount, 1) - assert.deepEqual(propsMethodSpies.setMaxModeTo.getCall(0).args, [true]) + assert.strictEqual(AmountMaxButton.prototype.setMaxAmount.callCount, 1) + assert.strictEqual(propsMethodSpies.setMaxModeTo.callCount, 1) + assert.deepStrictEqual(propsMethodSpies.setMaxModeTo.getCall(0).args, [ + true, + ]) }) it('should render the expected text when maxModeOn is false', function () { wrapper.setProps({ maxModeOn: false }) - assert.equal(wrapper.find('.send-v2__amount-max').text(), 'max_t') + assert.strictEqual(wrapper.find('.send-v2__amount-max').text(), 'max_t') }) }) }) diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js index ac49eea81..ba5325a43 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js @@ -39,7 +39,7 @@ proxyquire('../amount-max-button.container.js', { describe('amount-max-button container', function () { describe('mapStateToProps()', function () { it('should map the correct properties to props', function () { - assert.deepEqual(mapStateToProps('mockState'), { + assert.deepStrictEqual(mapStateToProps('mockState'), { balance: 'mockBalance:mockState', buttonDataLoading: 'mockButtonDataLoading:mockState', gasTotal: 'mockGasTotal:mockState', @@ -64,11 +64,14 @@ describe('amount-max-button container', function () { mapDispatchToPropsObject.setAmountToMax({ val: 11, foo: 'bar' }) assert(dispatchSpy.calledTwice) assert(duckActionSpies.updateSendErrors.calledOnce) - assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { - amount: null, - }) + assert.deepStrictEqual( + duckActionSpies.updateSendErrors.getCall(0).args[0], + { + amount: null, + }, + ) assert(actionSpies.updateSendAmount.calledOnce) - assert.equal(actionSpies.updateSendAmount.getCall(0).args[0], 12) + assert.strictEqual(actionSpies.updateSendAmount.getCall(0).args[0], 12) }) }) @@ -76,7 +79,10 @@ describe('amount-max-button container', function () { it('should dispatch an action', function () { mapDispatchToPropsObject.setMaxModeTo('mockVal') assert(dispatchSpy.calledOnce) - assert.equal(actionSpies.setMaxModeTo.getCall(0).args[0], 'mockVal') + assert.strictEqual( + actionSpies.setMaxModeTo.getCall(0).args[0], + 'mockVal', + ) }) }) }) diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js index d103525f3..c99f0449c 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js @@ -4,7 +4,7 @@ import { calcMaxAmount } from '../amount-max-button.utils' describe('amount-max-button utils', function () { describe('calcMaxAmount()', function () { it('should calculate the correct amount when no sendToken defined', function () { - assert.deepEqual( + assert.deepStrictEqual( calcMaxAmount({ balance: 'ffffff', gasTotal: 'ff', @@ -15,7 +15,7 @@ describe('amount-max-button utils', function () { }) it('should calculate the correct amount when a sendToken is defined', function () { - assert.deepEqual( + assert.deepStrictEqual( calcMaxAmount({ sendToken: { decimals: 10, diff --git a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js index 80e7b45a2..27c4b3bd9 100644 --- a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js @@ -16,7 +16,7 @@ describe('SendAmountRow Component', function () { propsMethodSpies: { updateSendAmountError }, } = shallowRenderSendAmountRow() - assert.equal(updateSendAmountError.callCount, 0) + assert.strictEqual(updateSendAmountError.callCount, 0) instance.validateAmount('someAmount') @@ -39,7 +39,7 @@ describe('SendAmountRow Component', function () { propsMethodSpies: { updateGasFeeError }, } = shallowRenderSendAmountRow() - assert.equal(updateGasFeeError.callCount, 0) + assert.strictEqual(updateGasFeeError.callCount, 0) instance.validateAmount('someAmount') @@ -64,11 +64,11 @@ describe('SendAmountRow Component', function () { wrapper.setProps({ sendToken: null }) - assert.equal(updateGasFeeError.callCount, 0) + assert.strictEqual(updateGasFeeError.callCount, 0) instance.validateAmount('someAmount') - assert.equal(updateGasFeeError.callCount, 0) + assert.strictEqual(updateGasFeeError.callCount, 0) }) }) @@ -79,7 +79,7 @@ describe('SendAmountRow Component', function () { propsMethodSpies: { setMaxModeTo }, } = shallowRenderSendAmountRow() - assert.equal(setMaxModeTo.callCount, 0) + assert.strictEqual(setMaxModeTo.callCount, 0) instance.updateAmount('someAmount') @@ -92,7 +92,7 @@ describe('SendAmountRow Component', function () { propsMethodSpies: { updateSendAmount }, } = shallowRenderSendAmountRow() - assert.equal(updateSendAmount.callCount, 0) + assert.strictEqual(updateSendAmount.callCount, 0) instance.updateAmount('someAmount') @@ -104,7 +104,7 @@ describe('SendAmountRow Component', function () { it('should render a SendRowWrapper component', function () { const { wrapper } = shallowRenderSendAmountRow() - assert.equal(wrapper.find(SendRowWrapper).length, 1) + assert.strictEqual(wrapper.find(SendRowWrapper).length, 1) }) it('should pass the correct props to SendRowWrapper', function () { @@ -113,9 +113,9 @@ describe('SendAmountRow Component', function () { .find(SendRowWrapper) .props() - assert.equal(errorType, 'amount') - assert.equal(label, 'amount_t:') - assert.equal(showError, false) + assert.strictEqual(errorType, 'amount') + assert.strictEqual(label, 'amount_t:') + assert.strictEqual(showError, false) }) it('should render an AmountMaxButton as the first child of the SendRowWrapper', function () { @@ -142,11 +142,11 @@ describe('SendAmountRow Component', function () { .childAt(1) .props() - assert.equal(error, false) - assert.equal(value, 'mockAmount') - assert.equal(updateGas.callCount, 0) - assert.equal(updateAmount.callCount, 0) - assert.equal(validateAmount.callCount, 0) + assert.strictEqual(error, false) + assert.strictEqual(value, 'mockAmount') + assert.strictEqual(updateGas.callCount, 0) + assert.strictEqual(updateAmount.callCount, 0) + assert.strictEqual(validateAmount.callCount, 0) onChange('mockNewAmount') diff --git a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js index 8b7dc5b8e..3137ef1b4 100644 --- a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js @@ -50,7 +50,10 @@ describe('send-amount-row container', function () { mapDispatchToPropsObject.setMaxModeTo('mockBool') assert(dispatchSpy.calledOnce) assert(actionSpies.setMaxModeTo.calledOnce) - assert.equal(actionSpies.setMaxModeTo.getCall(0).args[0], 'mockBool') + assert.strictEqual( + actionSpies.setMaxModeTo.getCall(0).args[0], + 'mockBool', + ) }) }) @@ -59,7 +62,7 @@ describe('send-amount-row container', function () { mapDispatchToPropsObject.updateSendAmount('mockAmount') assert(dispatchSpy.calledOnce) assert(actionSpies.updateSendAmount.calledOnce) - assert.equal( + assert.strictEqual( actionSpies.updateSendAmount.getCall(0).args[0], 'mockAmount', ) @@ -71,10 +74,13 @@ describe('send-amount-row container', function () { mapDispatchToPropsObject.updateGasFeeError({ some: 'data' }) assert(dispatchSpy.calledOnce) assert(duckActionSpies.updateSendErrors.calledOnce) - assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { - some: 'data', - mockGasFeeErrorChange: true, - }) + assert.deepStrictEqual( + duckActionSpies.updateSendErrors.getCall(0).args[0], + { + some: 'data', + mockGasFeeErrorChange: true, + }, + ) }) }) @@ -83,10 +89,13 @@ describe('send-amount-row container', function () { mapDispatchToPropsObject.updateSendAmountError({ some: 'data' }) assert(dispatchSpy.calledOnce) assert(duckActionSpies.updateSendErrors.calledOnce) - assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { - some: 'data', - mockChange: true, - }) + assert.deepStrictEqual( + duckActionSpies.updateSendErrors.getCall(0).args[0], + { + some: 'data', + mockChange: true, + }, + ) }) }) }) diff --git a/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/tests/gas-fee-display.component.test.js b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/tests/gas-fee-display.component.test.js index 2dd085a38..817c324ea 100644 --- a/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/tests/gas-fee-display.component.test.js +++ b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/tests/gas-fee-display.component.test.js @@ -33,7 +33,7 @@ describe('GasFeeDisplay Component', function () { }) it('should render a CurrencyDisplay component', function () { - assert.equal(wrapper.find(UserPreferencedCurrencyDisplay).length, 2) + assert.strictEqual(wrapper.find(UserPreferencedCurrencyDisplay).length, 2) }) it('should render the CurrencyDisplay with the correct props', function () { @@ -41,20 +41,20 @@ describe('GasFeeDisplay Component', function () { .find(UserPreferencedCurrencyDisplay) .at(0) .props() - assert.equal(type, 'PRIMARY') - assert.equal(value, 'mockGasTotal') + assert.strictEqual(type, 'PRIMARY') + assert.strictEqual(value, 'mockGasTotal') }) it('should render the reset button with the correct props', function () { const { onClick, className } = wrapper.find('button').props() - assert.equal(className, 'gas-fee-reset') - assert.equal(propsMethodSpies.onReset.callCount, 0) + assert.strictEqual(className, 'gas-fee-reset') + assert.strictEqual(propsMethodSpies.onReset.callCount, 0) onClick() - assert.equal(propsMethodSpies.onReset.callCount, 1) + assert.strictEqual(propsMethodSpies.onReset.callCount, 1) }) it('should render the reset button with the correct text', function () { - assert.equal(wrapper.find('button').text(), 'reset_t') + assert.strictEqual(wrapper.find('button').text(), 'reset_t') }) }) }) diff --git a/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js index a80671c5f..926e9ae02 100644 --- a/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js +++ b/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js @@ -43,8 +43,8 @@ describe('SendGasRow Component', function () { }) it('should render a SendRowWrapper component', function () { - assert.equal(wrapper.name(), 'Fragment') - assert.equal(wrapper.at(0).find(SendRowWrapper).length, 1) + assert.strictEqual(wrapper.name(), 'Fragment') + assert.strictEqual(wrapper.at(0).find(SendRowWrapper).length, 1) }) it('should pass the correct props to SendRowWrapper', function () { @@ -53,9 +53,9 @@ describe('SendGasRow Component', function () { .first() .props() - assert.equal(label, 'transactionFee_t:') - assert.equal(showError, true) - assert.equal(errorType, 'gasFee') + assert.strictEqual(label, 'transactionFee_t:') + assert.strictEqual(showError, true) + assert.strictEqual(errorType, 'gasFee') }) it('should render a GasFeeDisplay as a child of the SendRowWrapper', function () { @@ -68,27 +68,27 @@ describe('SendGasRow Component', function () { .first() .childAt(0) .props() - assert.equal(gasLoadingError, false) - assert.equal(gasTotal, 'mockGasTotal') - assert.equal(propsMethodSpies.resetGasButtons.callCount, 0) + assert.strictEqual(gasLoadingError, false) + assert.strictEqual(gasTotal, 'mockGasTotal') + assert.strictEqual(propsMethodSpies.resetGasButtons.callCount, 0) onReset() - assert.equal(propsMethodSpies.resetGasButtons.callCount, 1) + assert.strictEqual(propsMethodSpies.resetGasButtons.callCount, 1) }) it('should render the GasPriceButtonGroup if gasButtonGroupShown is true', function () { wrapper.setProps({ gasButtonGroupShown: true }) const rendered = wrapper.find(SendRowWrapper).first().childAt(0) - assert.equal(wrapper.children().length, 2) + assert.strictEqual(wrapper.children().length, 2) const gasPriceButtonGroup = rendered.childAt(0) assert(gasPriceButtonGroup.is(GasPriceButtonGroup)) assert(gasPriceButtonGroup.hasClass('gas-price-button-group--small')) - assert.equal(gasPriceButtonGroup.props().showCheck, false) - assert.equal( + assert.strictEqual(gasPriceButtonGroup.props().showCheck, false) + assert.strictEqual( gasPriceButtonGroup.props().someGasPriceButtonGroupProp, 'foo', ) - assert.equal( + assert.strictEqual( gasPriceButtonGroup.props().anotherGasPriceButtonGroupProp, 'bar', ) @@ -97,14 +97,14 @@ describe('SendGasRow Component', function () { it('should render an advanced options button if gasButtonGroupShown is true', function () { wrapper.setProps({ gasButtonGroupShown: true }) const rendered = wrapper.find(SendRowWrapper).last() - assert.equal(wrapper.children().length, 2) + assert.strictEqual(wrapper.children().length, 2) const advancedOptionsButton = rendered.childAt(0) - assert.equal(advancedOptionsButton.text(), 'advancedOptions_t') + assert.strictEqual(advancedOptionsButton.text(), 'advancedOptions_t') - assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 0) + assert.strictEqual(propsMethodSpies.showCustomizeGasModal.callCount, 0) advancedOptionsButton.props().onClick() - assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1) + assert.strictEqual(propsMethodSpies.showCustomizeGasModal.callCount, 1) }) }) }) diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js index 975b26748..41d318ffd 100644 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js +++ b/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js @@ -18,16 +18,16 @@ describe('SendRowErrorMessage Component', function () { }) it('should render null if the passed errors do not contain an error of errorType', function () { - assert.equal(wrapper.find('.send-v2__error').length, 0) - assert.equal(wrapper.html(), null) + assert.strictEqual(wrapper.find('.send-v2__error').length, 0) + assert.strictEqual(wrapper.html(), null) }) it('should render an error message if the passed errors contain an error of errorType', function () { wrapper.setProps({ errors: { error1: 'abc', error2: 'def', error3: 'xyz' }, }) - assert.equal(wrapper.find('.send-v2__error').length, 1) - assert.equal(wrapper.find('.send-v2__error').text(), 'xyz_t') + assert.strictEqual(wrapper.find('.send-v2__error').length, 1) + assert.strictEqual(wrapper.find('.send-v2__error').text(), 'xyz_t') }) }) }) diff --git a/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js b/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js index c85b50bfd..dd3a4da8f 100644 --- a/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js +++ b/ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js @@ -16,7 +16,7 @@ proxyquire('../send-row-error-message.container.js', { describe('send-row-error-message container', function () { describe('mapStateToProps()', function () { it('should map the correct properties to props', function () { - assert.deepEqual( + assert.deepStrictEqual( mapStateToProps('mockState', { errorType: 'someType' }), { errors: 'mockErrors:mockState', diff --git a/ui/app/pages/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js b/ui/app/pages/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js index c2aa7c1f1..4a4b3189a 100644 --- a/ui/app/pages/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js +++ b/ui/app/pages/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js @@ -22,22 +22,22 @@ describe('SendContent Component', function () { }) it('should render a div with a send-v2__form-row class', function () { - assert.equal(wrapper.find('div.send-v2__form-row').length, 1) + assert.strictEqual(wrapper.find('div.send-v2__form-row').length, 1) }) it('should render two children of the root div, with send-v2_form label and field classes', function () { - assert.equal( + assert.strictEqual( wrapper.find('.send-v2__form-row > .send-v2__form-label').length, 1, ) - assert.equal( + assert.strictEqual( wrapper.find('.send-v2__form-row > .send-v2__form-field').length, 1, ) }) it('should render the label as a child of the send-v2__form-label', function () { - assert.equal( + assert.strictEqual( wrapper .find('.send-v2__form-row > .send-v2__form-label') .childAt(0) @@ -47,7 +47,7 @@ describe('SendContent Component', function () { }) it('should render its first child as a child of the send-v2__form-field', function () { - assert.equal( + assert.strictEqual( wrapper .find('.send-v2__form-row > .send-v2__form-field') .childAt(0) @@ -57,18 +57,18 @@ describe('SendContent Component', function () { }) it('should not render a SendRowErrorMessage if showError is false', function () { - assert.equal(wrapper.find(SendRowErrorMessage).length, 0) + assert.strictEqual(wrapper.find(SendRowErrorMessage).length, 0) }) it('should render a SendRowErrorMessage with and errorType props if showError is true', function () { wrapper.setProps({ showError: true }) - assert.equal(wrapper.find(SendRowErrorMessage).length, 1) + assert.strictEqual(wrapper.find(SendRowErrorMessage).length, 1) const expectedSendRowErrorMessage = wrapper .find('.send-v2__form-row > .send-v2__form-label') .childAt(1) assert(expectedSendRowErrorMessage.is(SendRowErrorMessage)) - assert.deepEqual(expectedSendRowErrorMessage.props(), { + assert.deepStrictEqual(expectedSendRowErrorMessage.props(), { errorType: 'mockErrorType', }) }) @@ -84,7 +84,7 @@ describe('SendContent Component', function () { Mock Form Field , ) - assert.equal( + assert.strictEqual( wrapper .find('.send-v2__form-row > .send-v2__form-field') .childAt(0) @@ -104,7 +104,7 @@ describe('SendContent Component', function () { Mock Form Field , ) - assert.equal( + assert.strictEqual( wrapper .find('.send-v2__form-row > .send-v2__form-label') .childAt(1) diff --git a/ui/app/pages/send/send-content/tests/send-content-component.test.js b/ui/app/pages/send/send-content/tests/send-content-component.test.js index 30a9fba69..2628c516a 100644 --- a/ui/app/pages/send/send-content/tests/send-content-component.test.js +++ b/ui/app/pages/send/send-content/tests/send-content-component.test.js @@ -21,7 +21,7 @@ describe('SendContent Component', function () { describe('render', function () { it('should render a PageContainerContent component', function () { - assert.equal(wrapper.find(PageContainerContent).length, 1) + assert.strictEqual(wrapper.find(PageContainerContent).length, 1) }) it('should render a div with a .send-v2__form class as a child of PageContainerContent', function () { @@ -79,7 +79,7 @@ describe('SendContent Component', function () { PageContainerContentChild.childAt(3).is(SendGasRow), 'row[3] should be SendGasRow', ) - assert.equal(PageContainerContentChild.childAt(4).exists(), false) + assert.strictEqual(PageContainerContentChild.childAt(4).exists(), false) }) it('should not render the Dialog if contact has a name', function () { @@ -102,7 +102,7 @@ describe('SendContent Component', function () { PageContainerContentChild.childAt(2).is(SendGasRow), 'row[3] should be SendGasRow', ) - assert.equal(PageContainerContentChild.childAt(3).exists(), false) + assert.strictEqual(PageContainerContentChild.childAt(3).exists(), false) }) it('should not render the Dialog if it is an ownedAccount', function () { @@ -125,7 +125,7 @@ describe('SendContent Component', function () { PageContainerContentChild.childAt(2).is(SendGasRow), 'row[3] should be SendGasRow', ) - assert.equal(PageContainerContentChild.childAt(3).exists(), false) + assert.strictEqual(PageContainerContentChild.childAt(3).exists(), false) }) }) @@ -150,8 +150,8 @@ describe('SendContent Component', function () { const dialog = wrapper.find(Dialog).at(0) - assert.equal(dialog.props().type, 'warning') - assert.equal(dialog.props().children, 'watchout_t') - assert.equal(dialog.length, 1) + assert.strictEqual(dialog.props().type, 'warning') + assert.strictEqual(dialog.props().children, 'watchout_t') + assert.strictEqual(dialog.length, 1) }) }) diff --git a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js index 87a0e2d9a..d77b7fe87 100644 --- a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js +++ b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js @@ -71,16 +71,16 @@ describe('SendFooter Component', function () { describe('onCancel', function () { it('should call clearSend', function () { - assert.equal(propsMethodSpies.clearSend.callCount, 0) + assert.strictEqual(propsMethodSpies.clearSend.callCount, 0) wrapper.instance().onCancel() - assert.equal(propsMethodSpies.clearSend.callCount, 1) + assert.strictEqual(propsMethodSpies.clearSend.callCount, 1) }) it('should call history.push', function () { - assert.equal(historySpies.push.callCount, 0) + assert.strictEqual(historySpies.push.callCount, 0) wrapper.instance().onCancel() - assert.equal(historySpies.push.callCount, 1) - assert.equal( + assert.strictEqual(historySpies.push.callCount, 1) + assert.strictEqual( historySpies.push.getCall(0).args[0], 'mostRecentOverviewPage', ) @@ -133,7 +133,7 @@ describe('SendFooter Component', function () { Object.entries(config).forEach(([description, obj]) => { it(description, function () { wrapper.setProps(obj) - assert.equal( + assert.strictEqual( wrapper.instance().formShouldBeDisabled(), obj.expectedResult, ) @@ -145,16 +145,16 @@ describe('SendFooter Component', function () { it('should call addToAddressBookIfNew with the correct params', function () { wrapper.instance().onSubmit(MOCK_EVENT) assert(propsMethodSpies.addToAddressBookIfNew.calledOnce) - assert.deepEqual(propsMethodSpies.addToAddressBookIfNew.getCall(0).args, [ - 'mockTo', - ['mockAccount'], - ]) + assert.deepStrictEqual( + propsMethodSpies.addToAddressBookIfNew.getCall(0).args, + ['mockTo', ['mockAccount']], + ) }) it('should call props.update if editingTransactionId is truthy', async function () { await wrapper.instance().onSubmit(MOCK_EVENT) assert(propsMethodSpies.update.calledOnce) - assert.deepEqual(propsMethodSpies.update.getCall(0).args[0], { + assert.deepStrictEqual(propsMethodSpies.update.getCall(0).args[0], { data: undefined, amount: 'mockAmount', editingTransactionId: 'mockEditingTransactionId', @@ -168,14 +168,14 @@ describe('SendFooter Component', function () { }) it('should not call props.sign if editingTransactionId is truthy', function () { - assert.equal(propsMethodSpies.sign.callCount, 0) + assert.strictEqual(propsMethodSpies.sign.callCount, 0) }) it('should call props.sign if editingTransactionId is falsy', async function () { wrapper.setProps({ editingTransactionId: null }) await wrapper.instance().onSubmit(MOCK_EVENT) assert(propsMethodSpies.sign.calledOnce) - assert.deepEqual(propsMethodSpies.sign.getCall(0).args[0], { + assert.deepStrictEqual(propsMethodSpies.sign.getCall(0).args[0], { data: undefined, amount: 'mockAmount', from: 'mockAddress', @@ -187,13 +187,13 @@ describe('SendFooter Component', function () { }) it('should not call props.update if editingTransactionId is falsy', function () { - assert.equal(propsMethodSpies.update.callCount, 0) + assert.strictEqual(propsMethodSpies.update.callCount, 0) }) it('should call history.push', async function () { await wrapper.instance().onSubmit(MOCK_EVENT) - assert.equal(historySpies.push.callCount, 1) - assert.equal( + assert.strictEqual(historySpies.push.callCount, 1) + assert.strictEqual( historySpies.push.getCall(0).args[0], CONFIRM_TRANSACTION_ROUTE, ) @@ -234,22 +234,22 @@ describe('SendFooter Component', function () { }) it('should render a PageContainerFooter component', function () { - assert.equal(wrapper.find(PageContainerFooter).length, 1) + assert.strictEqual(wrapper.find(PageContainerFooter).length, 1) }) it('should pass the correct props to PageContainerFooter', function () { const { onCancel, onSubmit, disabled } = wrapper .find(PageContainerFooter) .props() - assert.equal(disabled, true) + assert.strictEqual(disabled, true) - assert.equal(SendFooter.prototype.onSubmit.callCount, 0) + assert.strictEqual(SendFooter.prototype.onSubmit.callCount, 0) onSubmit(MOCK_EVENT) - assert.equal(SendFooter.prototype.onSubmit.callCount, 1) + assert.strictEqual(SendFooter.prototype.onSubmit.callCount, 1) - assert.equal(SendFooter.prototype.onCancel.callCount, 0) + assert.strictEqual(SendFooter.prototype.onCancel.callCount, 0) onCancel() - assert.equal(SendFooter.prototype.onCancel.callCount, 1) + assert.strictEqual(SendFooter.prototype.onCancel.callCount, 1) }) }) }) diff --git a/ui/app/pages/send/send-footer/tests/send-footer-container.test.js b/ui/app/pages/send/send-footer/tests/send-footer-container.test.js index 74fe608c8..e037fe7cc 100644 --- a/ui/app/pages/send/send-footer/tests/send-footer-container.test.js +++ b/ui/app/pages/send/send-footer/tests/send-footer-container.test.js @@ -82,18 +82,21 @@ describe('send-footer container', function () { gasPrice: 'mockGasPrice', }) assert(dispatchSpy.calledOnce) - assert.deepEqual(utilsStubs.constructTxParams.getCall(0).args[0], { - data: undefined, - sendToken: { - address: '0xabc', + assert.deepStrictEqual( + utilsStubs.constructTxParams.getCall(0).args[0], + { + data: undefined, + sendToken: { + address: '0xabc', + }, + to: 'mockTo', + amount: 'mockAmount', + from: 'mockFrom', + gas: 'mockGas', + gasPrice: 'mockGasPrice', }, - to: 'mockTo', - amount: 'mockAmount', - from: 'mockFrom', - gas: 'mockGas', - gasPrice: 'mockGasPrice', - }) - assert.deepEqual(actionSpies.signTokenTx.getCall(0).args, [ + ) + assert.deepStrictEqual(actionSpies.signTokenTx.getCall(0).args, [ '0xabc', 'mockTo', 'mockAmount', @@ -111,16 +114,19 @@ describe('send-footer container', function () { gasPrice: 'mockGasPrice', }) assert(dispatchSpy.calledOnce) - assert.deepEqual(utilsStubs.constructTxParams.getCall(0).args[0], { - data: undefined, - sendToken: undefined, - to: 'mockTo', - amount: 'mockAmount', - from: 'mockFrom', - gas: 'mockGas', - gasPrice: 'mockGasPrice', - }) - assert.deepEqual(actionSpies.signTx.getCall(0).args, [ + assert.deepStrictEqual( + utilsStubs.constructTxParams.getCall(0).args[0], + { + data: undefined, + sendToken: undefined, + to: 'mockTo', + amount: 'mockAmount', + from: 'mockFrom', + gas: 'mockGas', + gasPrice: 'mockGasPrice', + }, + ) + assert.deepStrictEqual(actionSpies.signTx.getCall(0).args, [ { value: 'mockAmount' }, ]) }) @@ -139,18 +145,21 @@ describe('send-footer container', function () { unapprovedTxs: 'mockUnapprovedTxs', }) assert(dispatchSpy.calledOnce) - assert.deepEqual(utilsStubs.constructUpdatedTx.getCall(0).args[0], { - data: undefined, - to: 'mockTo', - amount: 'mockAmount', - from: 'mockFrom', - gas: 'mockGas', - gasPrice: 'mockGasPrice', - editingTransactionId: 'mockEditingTransactionId', - sendToken: { address: 'mockAddress' }, - unapprovedTxs: 'mockUnapprovedTxs', - }) - assert.equal( + assert.deepStrictEqual( + utilsStubs.constructUpdatedTx.getCall(0).args[0], + { + data: undefined, + to: 'mockTo', + amount: 'mockAmount', + from: 'mockFrom', + gas: 'mockGas', + gasPrice: 'mockGasPrice', + editingTransactionId: 'mockEditingTransactionId', + sendToken: { address: 'mockAddress' }, + unapprovedTxs: 'mockUnapprovedTxs', + }, + ) + assert.strictEqual( actionSpies.updateTransaction.getCall(0).args[0], 'mockConstructedUpdatedTxParams', ) @@ -165,11 +174,11 @@ describe('send-footer container', function () { 'mockNickname', ) assert(dispatchSpy.calledOnce) - assert.equal( + assert.strictEqual( utilsStubs.addressIsNew.getCall(0).args[0], 'mockToAccounts', ) - assert.deepEqual(actionSpies.addToAddressBook.getCall(0).args, [ + assert.deepStrictEqual(actionSpies.addToAddressBook.getCall(0).args, [ '0xmockNewAddress', 'mockNickname', ]) diff --git a/ui/app/pages/send/send-footer/tests/send-footer-utils.test.js b/ui/app/pages/send/send-footer/tests/send-footer-utils.test.js index f462ff22f..52a84a993 100644 --- a/ui/app/pages/send/send-footer/tests/send-footer-utils.test.js +++ b/ui/app/pages/send/send-footer/tests/send-footer-utils.test.js @@ -19,7 +19,7 @@ const { addressIsNew, constructTxParams, constructUpdatedTx } = sendUtils describe('send-footer utils', function () { describe('addressIsNew()', function () { it('should return false if the address exists in toAccounts', function () { - assert.equal( + assert.strictEqual( addressIsNew( [{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }], '0xdef', @@ -29,7 +29,7 @@ describe('send-footer utils', function () { }) it('should return true if the address does not exists in toAccounts', function () { - assert.equal( + assert.strictEqual( addressIsNew( [{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }], '0xxyz', @@ -41,7 +41,7 @@ describe('send-footer utils', function () { describe('constructTxParams()', function () { it('should return a new txParams object with data if there data is given', function () { - assert.deepEqual( + assert.deepStrictEqual( constructTxParams({ data: 'someData', sendToken: undefined, @@ -63,7 +63,7 @@ describe('send-footer utils', function () { }) it('should return a new txParams object with value and to properties if there is no sendToken', function () { - assert.deepEqual( + assert.deepStrictEqual( constructTxParams({ sendToken: undefined, to: 'mockTo', @@ -84,7 +84,7 @@ describe('send-footer utils', function () { }) it('should return a new txParams object without a to property and a 0 value if there is a sendToken', function () { - assert.deepEqual( + assert.deepStrictEqual( constructTxParams({ sendToken: { address: '0x0' }, to: 'mockTo', @@ -124,7 +124,7 @@ describe('send-footer utils', function () { }, }, }) - assert.deepEqual(result, { + assert.deepStrictEqual(result, { unapprovedTxParam: 'someOtherParam', txParams: { from: '0xmockFrom', @@ -159,7 +159,7 @@ describe('send-footer utils', function () { }, }) - assert.deepEqual(result, { + assert.deepStrictEqual(result, { unapprovedTxParam: 'someOtherParam', txParams: { from: '0xmockFrom', @@ -191,7 +191,7 @@ describe('send-footer utils', function () { }, }) - assert.deepEqual(result, { + assert.deepStrictEqual(result, { unapprovedTxParam: 'someOtherParam', txParams: { from: '0xmockFrom', diff --git a/ui/app/pages/send/send-header/tests/send-header-component.test.js b/ui/app/pages/send/send-header/tests/send-header-component.test.js index e7abd308d..03168bed1 100644 --- a/ui/app/pages/send/send-header/tests/send-header-component.test.js +++ b/ui/app/pages/send/send-header/tests/send-header-component.test.js @@ -43,16 +43,16 @@ describe('SendHeader Component', function () { describe('onClose', function () { it('should call clearSend', function () { - assert.equal(propsMethodSpies.clearSend.callCount, 0) + assert.strictEqual(propsMethodSpies.clearSend.callCount, 0) wrapper.instance().onClose() - assert.equal(propsMethodSpies.clearSend.callCount, 1) + assert.strictEqual(propsMethodSpies.clearSend.callCount, 1) }) it('should call history.push', function () { - assert.equal(historySpies.push.callCount, 0) + assert.strictEqual(historySpies.push.callCount, 0) wrapper.instance().onClose() - assert.equal(historySpies.push.callCount, 1) - assert.equal( + assert.strictEqual(historySpies.push.callCount, 1) + assert.strictEqual( historySpies.push.getCall(0).args[0], 'mostRecentOverviewPage', ) @@ -61,15 +61,15 @@ describe('SendHeader Component', function () { describe('render', function () { it('should render a PageContainerHeader component', function () { - assert.equal(wrapper.find(PageContainerHeader).length, 1) + assert.strictEqual(wrapper.find(PageContainerHeader).length, 1) }) it('should pass the correct props to PageContainerHeader', function () { const { onClose, title } = wrapper.find(PageContainerHeader).props() - assert.equal(title, 'mockTitleKey') - assert.equal(SendHeader.prototype.onClose.callCount, 0) + assert.strictEqual(title, 'mockTitleKey') + assert.strictEqual(SendHeader.prototype.onClose.callCount, 0) onClose() - assert.equal(SendHeader.prototype.onClose.callCount, 1) + assert.strictEqual(SendHeader.prototype.onClose.callCount, 1) }) }) }) diff --git a/ui/app/pages/send/tests/send-component.test.js b/ui/app/pages/send/tests/send-component.test.js index 4c5cd04e3..458082e7d 100644 --- a/ui/app/pages/send/tests/send-component.test.js +++ b/ui/app/pages/send/tests/send-component.test.js @@ -106,27 +106,27 @@ describe('Send Component', function () { describe('componentDidMount', function () { it('should call props.fetchBasicGasAndTimeEstimates', function () { propsMethodSpies.fetchBasicGasEstimates.resetHistory() - assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 0) + assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 0) wrapper.instance().componentDidMount() - assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 1) + assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 1) }) it('should call this.updateGas', async function () { SendTransactionScreen.prototype.updateGas.resetHistory() propsMethodSpies.updateSendErrors.resetHistory() - assert.equal(SendTransactionScreen.prototype.updateGas.callCount, 0) + assert.strictEqual(SendTransactionScreen.prototype.updateGas.callCount, 0) wrapper.instance().componentDidMount() await timeout(250) - assert.equal(SendTransactionScreen.prototype.updateGas.callCount, 1) + assert.strictEqual(SendTransactionScreen.prototype.updateGas.callCount, 1) }) }) describe('componentWillUnmount', function () { it('should call this.props.resetSendState', function () { propsMethodSpies.resetSendState.resetHistory() - assert.equal(propsMethodSpies.resetSendState.callCount, 0) + assert.strictEqual(propsMethodSpies.resetSendState.callCount, 0) wrapper.instance().componentWillUnmount() - assert.equal(propsMethodSpies.resetSendState.callCount, 1) + assert.strictEqual(propsMethodSpies.resetSendState.callCount, 1) }) }) @@ -139,7 +139,7 @@ describe('Send Component', function () { }, }) assert(utilsMethodStubs.doesAmountErrorRequireUpdate.calledTwice) - assert.deepEqual( + assert.deepStrictEqual( utilsMethodStubs.doesAmountErrorRequireUpdate.getCall(0).args[0], { balance: 'mockBalance', @@ -164,7 +164,7 @@ describe('Send Component', function () { balance: 'mockBalance', }, }) - assert.equal(utilsMethodStubs.getAmountErrorObject.callCount, 0) + assert.strictEqual(utilsMethodStubs.getAmountErrorObject.callCount, 0) }) it('should call getAmountErrorObject if doesAmountErrorRequireUpdate returns true', function () { @@ -174,8 +174,8 @@ describe('Send Component', function () { balance: 'balanceChanged', }, }) - assert.equal(utilsMethodStubs.getAmountErrorObject.callCount, 1) - assert.deepEqual( + assert.strictEqual(utilsMethodStubs.getAmountErrorObject.callCount, 1) + assert.deepStrictEqual( utilsMethodStubs.getAmountErrorObject.getCall(0).args[0], { amount: 'mockAmount', @@ -200,8 +200,8 @@ describe('Send Component', function () { balance: 'balanceChanged', }, }) - assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 1) - assert.deepEqual( + assert.strictEqual(utilsMethodStubs.getGasFeeErrorObject.callCount, 1) + assert.deepStrictEqual( utilsMethodStubs.getGasFeeErrorObject.getCall(0).args[0], { balance: 'mockBalance', @@ -222,7 +222,7 @@ describe('Send Component', function () { wrapper.instance().componentDidUpdate({ from: { address: 'mockAddress', balance: 'mockBalance' }, }) - assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 0) + assert.strictEqual(utilsMethodStubs.getGasFeeErrorObject.callCount, 0) }) it('should not call getGasFeeErrorObject if doesAmountErrorRequireUpdate returns true but sendToken is falsy', function () { @@ -233,7 +233,7 @@ describe('Send Component', function () { balance: 'balanceChanged', }, }) - assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 0) + assert.strictEqual(utilsMethodStubs.getGasFeeErrorObject.callCount, 0) }) it('should call updateSendErrors with the expected params if sendToken is falsy', function () { @@ -244,11 +244,14 @@ describe('Send Component', function () { balance: 'balanceChanged', }, }) - assert.equal(propsMethodSpies.updateSendErrors.callCount, 1) - assert.deepEqual(propsMethodSpies.updateSendErrors.getCall(0).args[0], { - amount: 'mockAmountError', - gasFee: null, - }) + assert.strictEqual(propsMethodSpies.updateSendErrors.callCount, 1) + assert.deepStrictEqual( + propsMethodSpies.updateSendErrors.getCall(0).args[0], + { + amount: 'mockAmountError', + gasFee: null, + }, + ) }) it('should call updateSendErrors with the expected params if sendToken is truthy', function () { @@ -261,11 +264,14 @@ describe('Send Component', function () { balance: 'balanceChanged', }, }) - assert.equal(propsMethodSpies.updateSendErrors.callCount, 1) - assert.deepEqual(propsMethodSpies.updateSendErrors.getCall(0).args[0], { - amount: 'mockAmountError', - gasFee: 'mockGasFeeError', - }) + assert.strictEqual(propsMethodSpies.updateSendErrors.callCount, 1) + assert.deepStrictEqual( + propsMethodSpies.updateSendErrors.getCall(0).args[0], + { + amount: 'mockAmountError', + gasFee: 'mockGasFeeError', + }, + ) }) it('should not call updateSendTokenBalance or this.updateGas if network === prevNetwork', function () { @@ -278,8 +284,8 @@ describe('Send Component', function () { network: '3', sendToken: { address: 'mockTokenAddress', decimals: 18, symbol: 'TST' }, // Make sure not to hit updateGas when changing asset }) - assert.equal(propsMethodSpies.updateSendTokenBalance.callCount, 0) - assert.equal(SendTransactionScreen.prototype.updateGas.callCount, 0) + assert.strictEqual(propsMethodSpies.updateSendTokenBalance.callCount, 0) + assert.strictEqual(SendTransactionScreen.prototype.updateGas.callCount, 0) }) it('should not call updateSendTokenBalance or this.updateGas if network === loading', function () { @@ -293,8 +299,8 @@ describe('Send Component', function () { network: '3', sendToken: { address: 'mockTokenAddress', decimals: 18, symbol: 'TST' }, // Make sure not to hit updateGas when changing asset }) - assert.equal(propsMethodSpies.updateSendTokenBalance.callCount, 0) - assert.equal(SendTransactionScreen.prototype.updateGas.callCount, 0) + assert.strictEqual(propsMethodSpies.updateSendTokenBalance.callCount, 0) + assert.strictEqual(SendTransactionScreen.prototype.updateGas.callCount, 0) }) it('should call updateSendTokenBalance and this.updateGas with the correct params', function () { @@ -307,8 +313,8 @@ describe('Send Component', function () { network: '2', sendToken: { address: 'mockTokenAddress', decimals: 18, symbol: 'TST' }, // Make sure not to hit updateGas when changing asset }) - assert.equal(propsMethodSpies.updateSendTokenBalance.callCount, 1) - assert.deepEqual( + assert.strictEqual(propsMethodSpies.updateSendTokenBalance.callCount, 1) + assert.deepStrictEqual( propsMethodSpies.updateSendTokenBalance.getCall(0).args[0], { sendToken: { @@ -320,8 +326,8 @@ describe('Send Component', function () { address: 'mockAddress', }, ) - assert.equal(SendTransactionScreen.prototype.updateGas.callCount, 1) - assert.deepEqual( + assert.strictEqual(SendTransactionScreen.prototype.updateGas.callCount, 1) + assert.deepStrictEqual( SendTransactionScreen.prototype.updateGas.getCall(0).args, [], ) @@ -337,8 +343,11 @@ describe('Send Component', function () { network: '3', // Make sure not to hit updateGas when changing network sendToken: { address: 'newSelectedToken' }, }) - assert.equal(propsMethodSpies.updateToNicknameIfNecessary.callCount, 0) // Network did not change - assert.equal(propsMethodSpies.updateAndSetGasLimit.callCount, 1) + assert.strictEqual( + propsMethodSpies.updateToNicknameIfNecessary.callCount, + 0, + ) // Network did not change + assert.strictEqual(propsMethodSpies.updateAndSetGasLimit.callCount, 1) }) }) @@ -346,8 +355,8 @@ describe('Send Component', function () { it('should call updateAndSetGasLimit with the correct params if no to prop is passed', function () { propsMethodSpies.updateAndSetGasLimit.resetHistory() wrapper.instance().updateGas() - assert.equal(propsMethodSpies.updateAndSetGasLimit.callCount, 1) - assert.deepEqual( + assert.strictEqual(propsMethodSpies.updateAndSetGasLimit.callCount, 1) + assert.deepStrictEqual( propsMethodSpies.updateAndSetGasLimit.getCall(0).args[0], { blockGasLimit: 'mockBlockGasLimit', @@ -371,7 +380,7 @@ describe('Send Component', function () { propsMethodSpies.updateAndSetGasLimit.resetHistory() wrapper.setProps({ to: 'someAddress' }) wrapper.instance().updateGas() - assert.equal( + assert.strictEqual( propsMethodSpies.updateAndSetGasLimit.getCall(0).args[0].to, 'someaddress', ) @@ -380,7 +389,7 @@ describe('Send Component', function () { it('should call updateAndSetGasLimit with to set to lowercase if passed', function () { propsMethodSpies.updateAndSetGasLimit.resetHistory() wrapper.instance().updateGas({ to: '0xABC' }) - assert.equal( + assert.strictEqual( propsMethodSpies.updateAndSetGasLimit.getCall(0).args[0].to, '0xabc', ) @@ -389,22 +398,22 @@ describe('Send Component', function () { describe('render', function () { it('should render a page-container class', function () { - assert.equal(wrapper.find('.page-container').length, 1) + assert.strictEqual(wrapper.find('.page-container').length, 1) }) it('should render SendHeader and AddRecipient', function () { - assert.equal(wrapper.find(SendHeader).length, 1) - assert.equal(wrapper.find(AddRecipient).length, 1) + assert.strictEqual(wrapper.find(SendHeader).length, 1) + assert.strictEqual(wrapper.find(AddRecipient).length, 1) }) it('should pass the history prop to SendHeader and SendFooter', function () { wrapper.setProps({ to: '0x80F061544cC398520615B5d3e7A3BedD70cd4510', }) - assert.equal(wrapper.find(SendHeader).length, 1) - assert.equal(wrapper.find(SendContent).length, 1) - assert.equal(wrapper.find(SendFooter).length, 1) - assert.deepEqual(wrapper.find(SendFooter).props(), { + assert.strictEqual(wrapper.find(SendHeader).length, 1) + assert.strictEqual(wrapper.find(SendContent).length, 1) + assert.strictEqual(wrapper.find(SendFooter).length, 1) + assert.deepStrictEqual(wrapper.find(SendFooter).props(), { history: { mockProp: 'history-abc' }, }) }) @@ -413,7 +422,7 @@ describe('Send Component', function () { wrapper.setProps({ to: '0x80F061544cC398520615B5d3e7A3BedD70cd4510', }) - assert.equal(wrapper.find(SendContent).props().showHexData, true) + assert.strictEqual(wrapper.find(SendContent).props().showHexData, true) }) }) @@ -434,7 +443,7 @@ describe('Send Component', function () { '0x80F061544cC398520615B5d3e7A3BedD70cd4510', ) - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '0x80F061544cC398520615B5d3e7A3BedD70cd4510', toError: null, @@ -449,7 +458,7 @@ describe('Send Component', function () { ) clock.tick(1001) - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '0x80F061544cC398520615B5d3e7a3BedD70cd4510', toError: 'invalidAddressRecipient', @@ -465,7 +474,7 @@ describe('Send Component', function () { ) clock.tick(1001) - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '0x80F061544cC398520615B5d3e7a3BedD70cd4510', toError: 'invalidAddressRecipientNotEthNetwork', @@ -481,7 +490,7 @@ describe('Send Component', function () { ) clock.tick(1001) - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '0x80F061544cC398520615B5d3e7a3BedD70cd4510', toError: 'invalidAddressRecipientNotEthNetwork', @@ -489,7 +498,7 @@ describe('Send Component', function () { }) instance.onRecipientInputChange('') - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '', toError: '', @@ -505,7 +514,7 @@ describe('Send Component', function () { ) clock.tick(1001) - assert.deepEqual(instance.state, { + assert.deepStrictEqual(instance.state, { internalSearch: false, query: '0x13cb85823f78Cff38f0B0E90D3e975b8CB3AAd64', toError: null, diff --git a/ui/app/pages/send/tests/send-container.test.js b/ui/app/pages/send/tests/send-container.test.js index d6af26758..3a9f4a807 100644 --- a/ui/app/pages/send/tests/send-container.test.js +++ b/ui/app/pages/send/tests/send-container.test.js @@ -56,7 +56,7 @@ describe('send container', function () { it('should dispatch a setGasTotal action when editingTransactionId is truthy', function () { mapDispatchToPropsObject.updateAndSetGasLimit(mockProps) assert(dispatchSpy.calledOnce) - assert.equal(actionSpies.setGasTotal.getCall(0).args[0], '0x30x4') + assert.strictEqual(actionSpies.setGasTotal.getCall(0).args[0], '0x30x4') }) it('should dispatch an updateGasData action when editingTransactionId is falsy', function () { @@ -74,7 +74,7 @@ describe('send container', function () { editingTransactionId: false, }) assert(dispatchSpy.calledOnce) - assert.deepEqual(actionSpies.updateGasData.getCall(0).args[0], { + assert.deepStrictEqual(actionSpies.updateGasData.getCall(0).args[0], { gasPrice, selectedAddress, sendToken, @@ -96,7 +96,7 @@ describe('send container', function () { it('should dispatch an action', function () { mapDispatchToPropsObject.updateSendTokenBalance({ ...mockProps }) assert(dispatchSpy.calledOnce) - assert.deepEqual( + assert.deepStrictEqual( actionSpies.updateSendTokenBalance.getCall(0).args[0], mockProps, ) @@ -107,7 +107,7 @@ describe('send container', function () { it('should dispatch an action', function () { mapDispatchToPropsObject.updateSendErrors('mockError') assert(dispatchSpy.calledOnce) - assert.equal( + assert.strictEqual( duckActionSpies.updateSendErrors.getCall(0).args[0], 'mockError', ) @@ -118,7 +118,10 @@ describe('send container', function () { it('should dispatch an action', function () { mapDispatchToPropsObject.resetSendState() assert(dispatchSpy.calledOnce) - assert.equal(duckActionSpies.resetSendState.getCall(0).args.length, 0) + assert.strictEqual( + duckActionSpies.resetSendState.getCall(0).args.length, + 0, + ) }) }) }) diff --git a/ui/app/pages/send/tests/send-utils.test.js b/ui/app/pages/send/tests/send-utils.test.js index 9107dba46..853581e96 100644 --- a/ui/app/pages/send/tests/send-utils.test.js +++ b/ui/app/pages/send/tests/send-utils.test.js @@ -67,9 +67,9 @@ describe('send utils', function () { describe('calcGasTotal()', function () { it('should call multiplyCurrencies with the correct params and return the multiplyCurrencies return', function () { const result = calcGasTotal(12, 15) - assert.equal(result, '12x15') + assert.strictEqual(result, '12x15') const call_ = stubs.multiplyCurrencies.getCall(0).args - assert.deepEqual(call_, [ + assert.deepStrictEqual(call_, [ 12, 15, { @@ -112,14 +112,17 @@ describe('send utils', function () { } Object.entries(config).forEach(([description, obj]) => { it(description, function () { - assert.equal(doesAmountErrorRequireUpdate(obj), obj.expectedResult) + assert.strictEqual( + doesAmountErrorRequireUpdate(obj), + obj.expectedResult, + ) }) }) }) describe('generateTokenTransferData()', function () { it('should return undefined if not passed a send token', function () { - assert.equal( + assert.strictEqual( generateTokenTransferData({ toAddress: 'mockAddress', amount: '0xa', @@ -136,14 +139,14 @@ describe('send utils', function () { amount: 'ab', sendToken: { address: '0x0' }, }) - assert.deepEqual(stubs.rawEncode.getCall(0).args, [ + assert.deepStrictEqual(stubs.rawEncode.getCall(0).args, [ ['address', 'uint256'], ['mockAddress', '0xab'], ]) }) it('should return encoded token transfer data', function () { - assert.equal( + assert.strictEqual( generateTokenTransferData({ toAddress: 'mockAddress', amount: '0xa', @@ -189,7 +192,7 @@ describe('send utils', function () { } Object.entries(config).forEach(([description, obj]) => { it(description, function () { - assert.deepEqual(getAmountErrorObject(obj), obj.expectedResult) + assert.deepStrictEqual(getAmountErrorObject(obj), obj.expectedResult) }) }) }) @@ -213,14 +216,14 @@ describe('send utils', function () { } Object.entries(config).forEach(([description, obj]) => { it(description, function () { - assert.deepEqual(getGasFeeErrorObject(obj), obj.expectedResult) + assert.deepStrictEqual(getGasFeeErrorObject(obj), obj.expectedResult) }) }) }) describe('calcTokenBalance()', function () { it('should return the calculated token balance', function () { - assert.equal( + assert.strictEqual( calcTokenBalance({ sendToken: { address: '0x0', @@ -245,7 +248,7 @@ describe('send utils', function () { gasTotal: 17, primaryCurrency: 'ABC', }) - assert.deepEqual(stubs.addCurrencies.getCall(0).args, [ + assert.deepStrictEqual(stubs.addCurrencies.getCall(0).args, [ 15, 17, { @@ -254,7 +257,7 @@ describe('send utils', function () { toNumericBase: 'hex', }, ]) - assert.deepEqual(stubs.conversionGTE.getCall(0).args, [ + assert.deepStrictEqual(stubs.conversionGTE.getCall(0).args, [ { value: 100, fromNumericBase: 'hex', @@ -269,7 +272,7 @@ describe('send utils', function () { }, ]) - assert.equal(result, true) + assert.strictEqual(result, true) }) }) @@ -282,13 +285,13 @@ describe('send utils', function () { tokenBalance: 123, decimals: 10, }) - assert.deepEqual(stubs.conversionUtil.getCall(0).args, [ + assert.deepStrictEqual(stubs.conversionUtil.getCall(0).args, [ '0x10', { fromNumericBase: 'hex', }, ]) - assert.deepEqual(stubs.conversionGTE.getCall(0).args, [ + assert.deepStrictEqual(stubs.conversionGTE.getCall(0).args, [ { value: 123, fromNumericBase: 'hex', @@ -298,7 +301,7 @@ describe('send utils', function () { }, ]) - assert.equal(result, false) + assert.strictEqual(result, false) }) }) @@ -338,13 +341,16 @@ describe('send utils', function () { it('should call ethQuery.estimateGasForSend with the expected params', async function () { const result = await estimateGasForSend(baseMockParams) - assert.equal(baseMockParams.estimateGasMethod.callCount, 1) - assert.deepEqual(baseMockParams.estimateGasMethod.getCall(0).args[0], { - gasPrice: undefined, - value: undefined, - ...baseExpectedCall, - }) - assert.equal(result, '0xabc16') + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 1) + assert.deepStrictEqual( + baseMockParams.estimateGasMethod.getCall(0).args[0], + { + gasPrice: undefined, + value: undefined, + ...baseExpectedCall, + }, + ) + assert.strictEqual(result, '0xabc16') }) it('should call ethQuery.estimateGasForSend with the expected params when initialGasLimitHex is lower than the upperGasLimit', async function () { @@ -352,14 +358,17 @@ describe('send utils', function () { ...baseMockParams, blockGasLimit: '0xbcd', }) - assert.equal(baseMockParams.estimateGasMethod.callCount, 1) - assert.deepEqual(baseMockParams.estimateGasMethod.getCall(0).args[0], { - gasPrice: undefined, - value: undefined, - ...baseExpectedCall, - gas: '0xbcdx0.95', - }) - assert.equal(result, '0xabc16x1.5') + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 1) + assert.deepStrictEqual( + baseMockParams.estimateGasMethod.getCall(0).args[0], + { + gasPrice: undefined, + value: undefined, + ...baseExpectedCall, + gas: '0xbcdx0.95', + }, + ) + assert.strictEqual(result, '0xabc16x1.5') }) it('should call ethQuery.estimateGasForSend with a value of 0x0 and the expected data and to if passed a sendToken', async function () { @@ -368,55 +377,61 @@ describe('send utils', function () { sendToken: { address: 'mockAddress' }, ...baseMockParams, }) - assert.equal(baseMockParams.estimateGasMethod.callCount, 1) - assert.deepEqual(baseMockParams.estimateGasMethod.getCall(0).args[0], { - ...baseExpectedCall, - gasPrice: undefined, - value: '0x0', - data: '0xa9059cbb104c', - to: 'mockAddress', - }) - assert.equal(result, '0xabc16') + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 1) + assert.deepStrictEqual( + baseMockParams.estimateGasMethod.getCall(0).args[0], + { + ...baseExpectedCall, + gasPrice: undefined, + value: '0x0', + data: '0xa9059cbb104c', + to: 'mockAddress', + }, + ) + assert.strictEqual(result, '0xabc16') }) it('should call ethQuery.estimateGasForSend without a recipient if the recipient is empty and data passed', async function () { const data = 'mockData' const to = '' const result = await estimateGasForSend({ ...baseMockParams, data, to }) - assert.equal(baseMockParams.estimateGasMethod.callCount, 1) - assert.deepEqual(baseMockParams.estimateGasMethod.getCall(0).args[0], { - gasPrice: undefined, - value: '0xff', - data, - from: baseExpectedCall.from, - gas: baseExpectedCall.gas, - }) - assert.equal(result, '0xabc16') + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 1) + assert.deepStrictEqual( + baseMockParams.estimateGasMethod.getCall(0).args[0], + { + gasPrice: undefined, + value: '0xff', + data, + from: baseExpectedCall.from, + gas: baseExpectedCall.gas, + }, + ) + assert.strictEqual(result, '0xabc16') }) it(`should return ${SIMPLE_GAS_COST} if ethQuery.getCode does not return '0x'`, async function () { - assert.equal(baseMockParams.estimateGasMethod.callCount, 0) + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 0) const result = await estimateGasForSend({ ...baseMockParams, to: '0x123', }) - assert.equal(result, SIMPLE_GAS_COST) + assert.strictEqual(result, SIMPLE_GAS_COST) }) it(`should return ${SIMPLE_GAS_COST} if not passed a sendToken or truthy to address`, async function () { - assert.equal(baseMockParams.estimateGasMethod.callCount, 0) + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 0) const result = await estimateGasForSend({ ...baseMockParams, to: null }) - assert.equal(result, SIMPLE_GAS_COST) + assert.strictEqual(result, SIMPLE_GAS_COST) }) it(`should not return ${SIMPLE_GAS_COST} if passed a sendToken`, async function () { - assert.equal(baseMockParams.estimateGasMethod.callCount, 0) + assert.strictEqual(baseMockParams.estimateGasMethod.callCount, 0) const result = await estimateGasForSend({ ...baseMockParams, to: '0x123', sendToken: { address: '0x0' }, }) - assert.notEqual(result, SIMPLE_GAS_COST) + assert.notStrictEqual(result, SIMPLE_GAS_COST) }) it(`should return ${BASE_TOKEN_GAS_COST} if passed a sendToken but no to address`, async function () { @@ -425,7 +440,7 @@ describe('send utils', function () { to: null, sendToken: { address: '0x0' }, }) - assert.equal(result, BASE_TOKEN_GAS_COST) + assert.strictEqual(result, BASE_TOKEN_GAS_COST) }) it(`should return the adjusted blockGasLimit if it fails with a 'Transaction execution error.'`, async function () { @@ -433,7 +448,7 @@ describe('send utils', function () { ...baseMockParams, to: 'isContract willFailBecauseOf:Transaction execution error.', }) - assert.equal(result, '0x64x0.95') + assert.strictEqual(result, '0x64x0.95') }) it(`should return the adjusted blockGasLimit if it fails with a 'gas required exceeds allowance or always failing transaction.'`, async function () { @@ -442,7 +457,7 @@ describe('send utils', function () { to: 'isContract willFailBecauseOf:gas required exceeds allowance or always failing transaction.', }) - assert.equal(result, '0x64x0.95') + assert.strictEqual(result, '0x64x0.95') }) it(`should reject other errors`, async function () { @@ -452,44 +467,44 @@ describe('send utils', function () { to: 'isContract willFailBecauseOf:some other error', }) } catch (err) { - assert.equal(err.message, 'some other error') + assert.strictEqual(err.message, 'some other error') } }) }) describe('getToAddressForGasUpdate()', function () { it('should return empty string if all params are undefined or null', function () { - assert.equal(getToAddressForGasUpdate(undefined, null), '') + assert.strictEqual(getToAddressForGasUpdate(undefined, null), '') }) it('should return the first string that is not defined or null in lower case', function () { - assert.equal(getToAddressForGasUpdate('A', null), 'a') - assert.equal(getToAddressForGasUpdate(undefined, 'B'), 'b') + assert.strictEqual(getToAddressForGasUpdate('A', null), 'a') + assert.strictEqual(getToAddressForGasUpdate(undefined, 'B'), 'b') }) }) describe('removeLeadingZeroes()', function () { it('should remove leading zeroes from int when user types', function () { - assert.equal(removeLeadingZeroes('0'), '0') - assert.equal(removeLeadingZeroes('1'), '1') - assert.equal(removeLeadingZeroes('00'), '0') - assert.equal(removeLeadingZeroes('01'), '1') + assert.strictEqual(removeLeadingZeroes('0'), '0') + assert.strictEqual(removeLeadingZeroes('1'), '1') + assert.strictEqual(removeLeadingZeroes('00'), '0') + assert.strictEqual(removeLeadingZeroes('01'), '1') }) it('should remove leading zeroes from int when user copy/paste', function () { - assert.equal(removeLeadingZeroes('001'), '1') + assert.strictEqual(removeLeadingZeroes('001'), '1') }) it('should remove leading zeroes from float when user types', function () { - assert.equal(removeLeadingZeroes('0.'), '0.') - assert.equal(removeLeadingZeroes('0.0'), '0.0') - assert.equal(removeLeadingZeroes('0.00'), '0.00') - assert.equal(removeLeadingZeroes('0.001'), '0.001') - assert.equal(removeLeadingZeroes('0.10'), '0.10') + assert.strictEqual(removeLeadingZeroes('0.'), '0.') + assert.strictEqual(removeLeadingZeroes('0.0'), '0.0') + assert.strictEqual(removeLeadingZeroes('0.00'), '0.00') + assert.strictEqual(removeLeadingZeroes('0.001'), '0.001') + assert.strictEqual(removeLeadingZeroes('0.10'), '0.10') }) it('should remove leading zeroes from float when user copy/paste', function () { - assert.equal(removeLeadingZeroes('00.1'), '0.1') + assert.strictEqual(removeLeadingZeroes('00.1'), '0.1') }) }) }) diff --git a/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js b/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js index c86d50ab1..024702ae3 100644 --- a/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js +++ b/ui/app/pages/settings/advanced-tab/tests/advanced-tab-component.test.js @@ -24,7 +24,7 @@ describe('AdvancedTab Component', function () { }, ) - assert.equal(root.find('.settings-page__content-row').length, 10) + assert.strictEqual(root.find('.settings-page__content-row').length, 10) }) it('should update autoLockTimeLimit', function () { @@ -50,9 +50,9 @@ describe('AdvancedTab Component', function () { const textField = autoTimeout.find(TextField) textField.props().onChange({ target: { value: 1440 } }) - assert.equal(root.state().autoLockTimeLimit, 1440) + assert.strictEqual(root.state().autoLockTimeLimit, 1440) autoTimeout.find('.settings-tab__rpc-save-button').simulate('click') - assert.equal(setAutoLockTimeLimitSpy.args[0][0], 1440) + assert.strictEqual(setAutoLockTimeLimitSpy.args[0][0], 1440) }) }) diff --git a/ui/app/pages/settings/security-tab/tests/security-tab.test.js b/ui/app/pages/settings/security-tab/tests/security-tab.test.js index d15328d85..d45a47d35 100644 --- a/ui/app/pages/settings/security-tab/tests/security-tab.test.js +++ b/ui/app/pages/settings/security-tab/tests/security-tab.test.js @@ -37,7 +37,7 @@ describe('Security Tab', function () { seedWords.simulate('click') assert(props.history.push.calledOnce) - assert.equal(props.history.push.getCall(0).args[0], '/seed') + assert.strictEqual(props.history.push.getCall(0).args[0], '/seed') }) it('toggles incoming txs', function () { diff --git a/ui/app/pages/swaps/swaps.util.test.js b/ui/app/pages/swaps/swaps.util.test.js index edb9bcd2c..77bab1905 100644 --- a/ui/app/pages/swaps/swaps.util.test.js +++ b/ui/app/pages/swaps/swaps.util.test.js @@ -14,24 +14,24 @@ import { const swapsUtils = proxyquire('./swaps.util.js', { '../../helpers/utils/fetch-with-cache': { default: (url, fetchObject) => { - assert.equal(fetchObject.method, 'GET') + assert.strictEqual(fetchObject.method, 'GET') if (url.match(TRADES_BASE_PROD_URL)) { - assert.equal( + assert.strictEqual( url, 'https://api.metaswap.codefi.network/trades?destinationToken=0xE41d2489571d322189246DaFA5ebDe1F4699F498&sourceToken=0x617b3f8050a0BD94b6b1da02B4384eE5B4DF13F4&sourceAmount=2000000000000000000000000000000000000&slippage=3&timeout=10000&walletAddress=0xmockAddress', ) return Promise.resolve(MOCK_TRADE_RESPONSE_2) } if (url.match(TOKENS_BASE_PROD_URL)) { - assert.equal(url, TOKENS_BASE_PROD_URL) + assert.strictEqual(url, TOKENS_BASE_PROD_URL) return Promise.resolve(TOKENS) } if (url.match(AGGREGATOR_METADATA_BASE_PROD_URL)) { - assert.equal(url, AGGREGATOR_METADATA_BASE_PROD_URL) + assert.strictEqual(url, AGGREGATOR_METADATA_BASE_PROD_URL) return Promise.resolve(AGGREGATOR_METADATA) } if (url.match(TOP_ASSET_BASE_PROD_URL)) { - assert.equal(url, TOP_ASSET_BASE_PROD_URL) + assert.strictEqual(url, TOP_ASSET_BASE_PROD_URL) return Promise.resolve(TOP_ASSETS) } return Promise.resolve() @@ -100,31 +100,31 @@ describe('Swaps Util', function () { sourceTokenInfo: { ...TOKENS[0] }, destinationTokenInfo: { ...TOKENS[1] }, }) - assert.deepEqual(result, expectedResult2) + assert.deepStrictEqual(result, expectedResult2) }) }) describe('fetchTokens', function () { it('should fetch tokens', async function () { const result = await fetchTokens(true) - assert.deepEqual(result, TOKENS) + assert.deepStrictEqual(result, TOKENS) }) it('should fetch tokens on prod', async function () { const result = await fetchTokens(false) - assert.deepEqual(result, TOKENS) + assert.deepStrictEqual(result, TOKENS) }) }) describe('fetchAggregatorMetadata', function () { it('should fetch aggregator metadata', async function () { const result = await fetchAggregatorMetadata(true) - assert.deepEqual(result, AGGREGATOR_METADATA) + assert.deepStrictEqual(result, AGGREGATOR_METADATA) }) it('should fetch aggregator metadata on prod', async function () { const result = await fetchAggregatorMetadata(false) - assert.deepEqual(result, AGGREGATOR_METADATA) + assert.deepStrictEqual(result, AGGREGATOR_METADATA) }) }) @@ -148,12 +148,12 @@ describe('Swaps Util', function () { } it('should fetch top assets', async function () { const result = await fetchTopAssets(true) - assert.deepEqual(result, expectedResult) + assert.deepStrictEqual(result, expectedResult) }) it('should fetch top assets on prod', async function () { const result = await fetchTopAssets(false) - assert.deepEqual(result, expectedResult) + assert.deepStrictEqual(result, expectedResult) }) }) }) diff --git a/ui/app/pages/unlock-page/tests/unlock-page.test.js b/ui/app/pages/unlock-page/tests/unlock-page.test.js index 9e5d4266b..34b258469 100644 --- a/ui/app/pages/unlock-page/tests/unlock-page.test.js +++ b/ui/app/pages/unlock-page/tests/unlock-page.test.js @@ -32,7 +32,7 @@ describe('Unlock Page', function () { }) it('renders', function () { - assert.equal(wrapper.length, 1) + assert.strictEqual(wrapper.length, 1) }) it('changes password and submits', function () { @@ -40,9 +40,9 @@ describe('Unlock Page', function () { const loginButton = wrapper.find({ type: 'submit' }).last() const event = { target: { value: 'password' } } - assert.equal(wrapper.instance().state.password, '') + assert.strictEqual(wrapper.instance().state.password, '') passwordField.last().simulate('change', event) - assert.equal(wrapper.instance().state.password, 'password') + assert.strictEqual(wrapper.instance().state.password, 'password') loginButton.simulate('click') assert(props.onSubmit.calledOnce) diff --git a/ui/app/selectors/tests/confirm-transaction.test.js b/ui/app/selectors/tests/confirm-transaction.test.js index 53ab202ec..df8b3ae86 100644 --- a/ui/app/selectors/tests/confirm-transaction.test.js +++ b/ui/app/selectors/tests/confirm-transaction.test.js @@ -36,7 +36,7 @@ describe('Confirm Transaction Selector', function () { } it('returns number of txs in unapprovedTxs state with the same network plus unapproved signing method counts', function () { - assert.equal(unconfirmedTransactionsCountSelector(state), 4) + assert.strictEqual(unconfirmedTransactionsCountSelector(state), 4) }) }) @@ -58,7 +58,7 @@ describe('Confirm Transaction Selector', function () { } it('returns token address and calculated token amount', function () { - assert.deepEqual(sendTokenTokenAmountAndToAddressSelector(state), { + assert.deepStrictEqual(sendTokenTokenAmountAndToAddressSelector(state), { toAddress: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', tokenAmount: '0.01', }) @@ -82,7 +82,7 @@ describe('Confirm Transaction Selector', function () { } it('returns contract exchange rate in metamask state based on confirm transaction txParams token recipient', function () { - assert.equal(contractExchangeRateSelector(state), 10) + assert.strictEqual(contractExchangeRateSelector(state), '10') }) }) @@ -91,7 +91,7 @@ describe('Confirm Transaction Selector', function () { const state = { metamask: { conversionRate: 556.12 }, } - assert.equal(conversionRateSelector(state), 556.12) + assert.strictEqual(conversionRateSelector(state), 556.12) }) }) }) diff --git a/ui/app/selectors/tests/custom-gas.test.js b/ui/app/selectors/tests/custom-gas.test.js index e51d3a4a1..9cbbf5c0d 100644 --- a/ui/app/selectors/tests/custom-gas.test.js +++ b/ui/app/selectors/tests/custom-gas.test.js @@ -14,28 +14,28 @@ describe('custom-gas selectors', function () { describe('getCustomGasPrice()', function () { it('should return gas.customData.price', function () { const mockState = { gas: { customData: { price: 'mockPrice' } } } - assert.equal(getCustomGasPrice(mockState), 'mockPrice') + assert.strictEqual(getCustomGasPrice(mockState), 'mockPrice') }) }) describe('getCustomGasLimit()', function () { it('should return gas.customData.limit', function () { const mockState = { gas: { customData: { limit: 'mockLimit' } } } - assert.equal(getCustomGasLimit(mockState), 'mockLimit') + assert.strictEqual(getCustomGasLimit(mockState), 'mockLimit') }) }) describe('getCustomGasTotal()', function () { it('should return gas.customData.total', function () { const mockState = { gas: { customData: { total: 'mockTotal' } } } - assert.equal(getCustomGasTotal(mockState), 'mockTotal') + assert.strictEqual(getCustomGasTotal(mockState), 'mockTotal') }) }) describe('getCustomGasErrors()', function () { it('should return gas.errors', function () { const mockState = { gas: { errors: 'mockErrors' } } - assert.equal(getCustomGasErrors(mockState), 'mockErrors') + assert.strictEqual(getCustomGasErrors(mockState), 'mockErrors') }) }) @@ -279,7 +279,7 @@ describe('custom-gas selectors', function () { ] it('should return renderable data about basic estimates', function () { tests.forEach((test) => { - assert.deepEqual( + assert.deepStrictEqual( getRenderableBasicEstimateData( test.mockState, '0x5208', @@ -528,7 +528,7 @@ describe('custom-gas selectors', function () { ] it('should return renderable data about basic estimates appropriate for buttons with less info', function () { tests.forEach((test) => { - assert.deepEqual( + assert.deepStrictEqual( getRenderableEstimateDataForSmallButtonsFromGWEI(test.mockState), test.expectedResult, ) diff --git a/ui/app/selectors/tests/permissions.test.js b/ui/app/selectors/tests/permissions.test.js index 39646f4d0..4750afa60 100644 --- a/ui/app/selectors/tests/permissions.test.js +++ b/ui/app/selectors/tests/permissions.test.js @@ -64,7 +64,7 @@ describe('selectors', function () { }, } const extensionId = undefined - assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [ + assert.deepStrictEqual(getConnectedDomainsForSelectedAddress(mockState), [ { extensionId, icon: 'https://peepeth.com/favicon-32x32.png', @@ -142,7 +142,7 @@ describe('selectors', function () { }, } const extensionId = undefined - assert.deepEqual(getConnectedDomainsForSelectedAddress(mockState), [ + assert.deepStrictEqual(getConnectedDomainsForSelectedAddress(mockState), [ { extensionId, name: 'Remix - Ethereum IDE', @@ -279,36 +279,39 @@ describe('selectors', function () { } it('should return connected accounts sorted by last selected, then by keyring controller order', function () { - assert.deepEqual(getOrderedConnectedAccountsForActiveTab(mockState), [ - { - address: '0xb3958fb96c8201486ae20be1d5c9f58083df343a', - name: 'Account 2', - lastActive: 1586359844192, - lastSelected: 1586359844193, - }, - { - address: '0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5', - name: 'Account 1', - lastActive: 1586359844192, - lastSelected: 1586359844192, - }, - { - address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', - name: 'Account 3', - lastActive: 1586359844192, - lastSelected: 1586359844192, - }, - { - address: '0x7250739de134d33ec7ab1ee592711e15098c9d2d', - name: 'Really Long Name That Should Be Truncated', - lastActive: 1586359844192, - }, - { - address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4', - name: 'Account 4', - lastActive: 1586359844192, - }, - ]) + assert.deepStrictEqual( + getOrderedConnectedAccountsForActiveTab(mockState), + [ + { + address: '0xb3958fb96c8201486ae20be1d5c9f58083df343a', + name: 'Account 2', + lastActive: 1586359844192, + lastSelected: 1586359844193, + }, + { + address: '0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5', + name: 'Account 1', + lastActive: 1586359844192, + lastSelected: 1586359844192, + }, + { + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + name: 'Account 3', + lastActive: 1586359844192, + lastSelected: 1586359844192, + }, + { + address: '0x7250739de134d33ec7ab1ee592711e15098c9d2d', + name: 'Really Long Name That Should Be Truncated', + lastActive: 1586359844192, + }, + { + address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4', + name: 'Account 4', + lastActive: 1586359844192, + }, + ], + ) }) }) @@ -415,7 +418,7 @@ describe('selectors', function () { } it('should return a list of permissions strings', function () { - assert.deepEqual(getPermissionsForActiveTab(mockState), [ + assert.deepStrictEqual(getPermissionsForActiveTab(mockState), [ { key: 'eth_accounts', }, diff --git a/ui/app/selectors/tests/selectors.test.js b/ui/app/selectors/tests/selectors.test.js index ed76b7305..be03752a9 100644 --- a/ui/app/selectors/tests/selectors.test.js +++ b/ui/app/selectors/tests/selectors.test.js @@ -5,12 +5,15 @@ import mockState from '../../../../test/data/mock-state.json' describe('Selectors', function () { describe('#getSelectedAddress', function () { it('returns undefined if selectedAddress is undefined', function () { - assert.equal(selectors.getSelectedAddress({ metamask: {} }), undefined) + assert.strictEqual( + selectors.getSelectedAddress({ metamask: {} }), + undefined, + ) }) it('returns selectedAddress', function () { const selectedAddress = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' - assert.equal( + assert.strictEqual( selectors.getSelectedAddress({ metamask: { selectedAddress } }), selectedAddress, ) @@ -18,7 +21,7 @@ describe('Selectors', function () { }) it('returns selected identity', function () { - assert.deepEqual(selectors.getSelectedIdentity(mockState), { + assert.deepStrictEqual(selectors.getSelectedIdentity(mockState), { address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', name: 'Test Account', }) @@ -26,14 +29,17 @@ describe('Selectors', function () { it('returns selected account', function () { const account = selectors.getSelectedAccount(mockState) - assert.equal(account.balance, '0x0') - assert.equal(account.address, '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc') + assert.strictEqual(account.balance, '0x0') + assert.strictEqual( + account.address, + '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + ) }) describe('#getTokenExchangeRates', function () { it('returns token exchange rates', function () { const tokenExchangeRates = selectors.getTokenExchangeRates(mockState) - assert.deepEqual(tokenExchangeRates, { + assert.deepStrictEqual(tokenExchangeRates, { '0x108cf70c7d384c552f42c07c41c0e1e46d77ea0d': 0.00039345803819379796, '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5': 0.00008189274407698049, }) @@ -42,7 +48,7 @@ describe('Selectors', function () { describe('#getAddressBook', function () { it('should return the address book', function () { - assert.deepEqual(selectors.getAddressBook(mockState), [ + assert.deepStrictEqual(selectors.getAddressBook(mockState), [ { address: '0xc42edfcc21ed14dda456aa0756c153f7985d8813', chainId: '0x4', @@ -58,39 +64,39 @@ describe('Selectors', function () { const accountsWithSendEther = selectors.accountsWithSendEtherInfoSelector( mockState, ) - assert.equal(accountsWithSendEther.length, 2) - assert.equal(accountsWithSendEther[0].balance, '0x0') - assert.equal( + assert.strictEqual(accountsWithSendEther.length, 2) + assert.strictEqual(accountsWithSendEther[0].balance, '0x0') + assert.strictEqual( accountsWithSendEther[0].address, '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', ) - assert.equal(accountsWithSendEther[0].name, 'Test Account') + assert.strictEqual(accountsWithSendEther[0].name, 'Test Account') }) it('returns selected account with balance, address, and name from accountsWithSendEtherInfoSelector', function () { const currentAccountwithSendEther = selectors.getCurrentAccountWithSendEtherInfo( mockState, ) - assert.equal(currentAccountwithSendEther.balance, '0x0') - assert.equal( + assert.strictEqual(currentAccountwithSendEther.balance, '0x0') + assert.strictEqual( currentAccountwithSendEther.address, '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', ) - assert.equal(currentAccountwithSendEther.name, 'Test Account') + assert.strictEqual(currentAccountwithSendEther.name, 'Test Account') }) it('#getGasIsLoading', function () { const gasIsLoading = selectors.getGasIsLoading(mockState) - assert.equal(gasIsLoading, false) + assert.strictEqual(gasIsLoading, false) }) it('#getCurrentCurrency', function () { const currentCurrency = selectors.getCurrentCurrency(mockState) - assert.equal(currentCurrency, 'usd') + assert.strictEqual(currentCurrency, 'usd') }) it('#getTotalUnapprovedCount', function () { const totalUnapprovedCount = selectors.getTotalUnapprovedCount(mockState) - assert.equal(totalUnapprovedCount, 1) + assert.strictEqual(totalUnapprovedCount, 1) }) }) diff --git a/ui/app/selectors/tests/send.test.js b/ui/app/selectors/tests/send.test.js index 8af4fb430..eeb080e3b 100644 --- a/ui/app/selectors/tests/send.test.js +++ b/ui/app/selectors/tests/send.test.js @@ -53,7 +53,7 @@ describe('send selectors', function () { describe('accountsWithSendEtherInfoSelector()', function () { it('should return an array of account objects with name info from identities', function () { - assert.deepEqual(accountsWithSendEtherInfoSelector(mockState), [ + assert.deepStrictEqual(accountsWithSendEtherInfoSelector(mockState), [ { code: '0x', balance: '0x47c9d71831c76efe', @@ -88,19 +88,19 @@ describe('send selectors', function () { describe('getBlockGasLimit', function () { it('should return the current block gas limit', function () { - assert.deepEqual(getBlockGasLimit(mockState), '0x4c1878') + assert.deepStrictEqual(getBlockGasLimit(mockState), '0x4c1878') }) }) describe('getConversionRate()', function () { it('should return the eth conversion rate', function () { - assert.deepEqual(getConversionRate(mockState), 1200.88200327) + assert.deepStrictEqual(getConversionRate(mockState), 1200.88200327) }) }) describe('getCurrentAccountWithSendEtherInfo()', function () { it('should return the currently selected account with identity info', function () { - assert.deepEqual(getCurrentAccountWithSendEtherInfo(mockState), { + assert.deepStrictEqual(getCurrentAccountWithSendEtherInfo(mockState), { code: '0x', balance: '0x0', nonce: '0x0', @@ -112,37 +112,37 @@ describe('send selectors', function () { describe('getNativeCurrency()', function () { it('should return the ticker symbol of the selected network', function () { - assert.equal(getNativeCurrency(mockState), 'ETH') + assert.strictEqual(getNativeCurrency(mockState), 'ETH') }) }) describe('getCurrentNetwork()', function () { it('should return the id of the currently selected network', function () { - assert.equal(getCurrentNetwork(mockState), '3') + assert.strictEqual(getCurrentNetwork(mockState), '3') }) }) describe('getGasLimit()', function () { it('should return the send.gasLimit', function () { - assert.equal(getGasLimit(mockState), '0xFFFF') + assert.strictEqual(getGasLimit(mockState), '0xFFFF') }) }) describe('getGasPrice()', function () { it('should return the send.gasPrice', function () { - assert.equal(getGasPrice(mockState), '0xaa') + assert.strictEqual(getGasPrice(mockState), '0xaa') }) }) describe('getGasTotal()', function () { it('should return the send.gasTotal', function () { - assert.equal(getGasTotal(mockState), 'a9ff56') + assert.strictEqual(getGasTotal(mockState), 'a9ff56') }) }) describe('getPrimaryCurrency()', function () { it('should return the symbol of the send token', function () { - assert.equal( + assert.strictEqual( getPrimaryCurrency({ metamask: { send: { token: { symbol: 'DEF' } } }, }), @@ -153,7 +153,7 @@ describe('send selectors', function () { describe('getSendToken()', function () { it('should return the current send token if set', function () { - assert.deepEqual( + assert.deepStrictEqual( getSendToken({ metamask: { send: { @@ -176,7 +176,7 @@ describe('send selectors', function () { describe('getSendTokenContract()', function () { it('should return the contract at the send token address', function () { - assert.equal( + assert.strictEqual( getSendTokenContract({ metamask: { send: { @@ -194,7 +194,7 @@ describe('send selectors', function () { it('should return null if send token is not set', function () { const modifiedMetamaskState = { ...mockState.metamask, send: {} } - assert.equal( + assert.strictEqual( getSendTokenContract({ ...mockState, metamask: modifiedMetamaskState }), null, ) @@ -203,31 +203,31 @@ describe('send selectors', function () { describe('getSendAmount()', function () { it('should return the send.amount', function () { - assert.equal(getSendAmount(mockState), '0x080') + assert.strictEqual(getSendAmount(mockState), '0x080') }) }) describe('getSendEditingTransactionId()', function () { it('should return the send.editingTransactionId', function () { - assert.equal(getSendEditingTransactionId(mockState), 97531) + assert.strictEqual(getSendEditingTransactionId(mockState), 97531) }) }) describe('getSendErrors()', function () { it('should return the send.errors', function () { - assert.deepEqual(getSendErrors(mockState), { someError: null }) + assert.deepStrictEqual(getSendErrors(mockState), { someError: null }) }) }) describe('getSendHexDataFeatureFlagState()', function () { it('should return the sendHexData feature flag state', function () { - assert.deepEqual(getSendHexDataFeatureFlagState(mockState), true) + assert.deepStrictEqual(getSendHexDataFeatureFlagState(mockState), true) }) }) describe('getSendFrom()', function () { it('should return the send.from', function () { - assert.deepEqual( + assert.deepStrictEqual( getSendFrom(mockState), '0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb', ) @@ -236,7 +236,7 @@ describe('send selectors', function () { describe('getSendFromBalance()', function () { it('should get the send.from balance if it exists', function () { - assert.equal(getSendFromBalance(mockState), '0x37452b1315889f80') + assert.strictEqual(getSendFromBalance(mockState), '0x37452b1315889f80') }) it('should get the selected account balance if the send.from does not exist', function () { @@ -248,13 +248,13 @@ describe('send selectors', function () { }, }, } - assert.equal(getSendFromBalance(editedMockState), '0x0') + assert.strictEqual(getSendFromBalance(editedMockState), '0x0') }) }) describe('getSendFromObject()', function () { it('should return send.from if it exists', function () { - assert.deepEqual(getSendFromObject(mockState), { + assert.deepStrictEqual(getSendFromObject(mockState), { address: '0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb', balance: '0x37452b1315889f80', code: '0x', @@ -271,7 +271,7 @@ describe('send selectors', function () { }, }, } - assert.deepEqual(getSendFromObject(editedMockState), { + assert.deepStrictEqual(getSendFromObject(editedMockState), { code: '0x', balance: '0x0', nonce: '0x0', @@ -282,19 +282,19 @@ describe('send selectors', function () { describe('getSendMaxModeState()', function () { it('should return send.maxModeOn', function () { - assert.equal(getSendMaxModeState(mockState), false) + assert.strictEqual(getSendMaxModeState(mockState), false) }) }) describe('getSendTo()', function () { it('should return send.to', function () { - assert.equal(getSendTo(mockState), '0x987fedabc') + assert.strictEqual(getSendTo(mockState), '0x987fedabc') }) }) describe('getSendToAccounts()', function () { it('should return an array including all the users accounts and the address book', function () { - assert.deepEqual(getSendToAccounts(mockState), [ + assert.deepStrictEqual(getSendToAccounts(mockState), [ { code: '0x', balance: '0x47c9d71831c76efe', @@ -334,13 +334,13 @@ describe('send selectors', function () { describe('getTokenBalance()', function () { it('should', function () { - assert.equal(getTokenBalance(mockState), 3434) + assert.strictEqual(getTokenBalance(mockState), 3434) }) }) describe('getUnapprovedTxs()', function () { it('should return the unapproved txs', function () { - assert.deepEqual(getUnapprovedTxs(mockState), { + assert.deepStrictEqual(getUnapprovedTxs(mockState), { 4768706228115573: { id: 4768706228115573, time: 1487363153561, @@ -375,7 +375,7 @@ describe('send selectors', function () { }, } - assert.equal(sendAmountIsInError(state), true) + assert.strictEqual(sendAmountIsInError(state), true) }) it('should return false if send.errors.amount is falsy', function () { @@ -387,7 +387,7 @@ describe('send selectors', function () { }, } - assert.equal(sendAmountIsInError(state), false) + assert.strictEqual(sendAmountIsInError(state), false) }) }) }) @@ -403,7 +403,7 @@ describe('send selectors', function () { }, } - assert.equal(getGasLoadingError(state), 'abc') + assert.strictEqual(getGasLoadingError(state), 'abc') }) }) @@ -417,7 +417,7 @@ describe('send selectors', function () { }, } - assert.equal(gasFeeIsInError(state), true) + assert.strictEqual(gasFeeIsInError(state), true) }) it('should return false send.errors.gasFee is falsely', function () { @@ -429,7 +429,7 @@ describe('send selectors', function () { }, } - assert.equal(gasFeeIsInError(state), false) + assert.strictEqual(gasFeeIsInError(state), false) }) }) @@ -441,7 +441,7 @@ describe('send selectors', function () { }, } - assert.equal(getGasButtonGroupShown(state), 'foobar') + assert.strictEqual(getGasButtonGroupShown(state), 'foobar') }) }) }) @@ -457,11 +457,14 @@ describe('send selectors', function () { describe('getTitleKey()', function () { it('should return the correct key when "to" is empty', function () { - assert.equal(getTitleKey(getMetamaskSendMockState({})), 'addRecipient') + assert.strictEqual( + getTitleKey(getMetamaskSendMockState({})), + 'addRecipient', + ) }) it('should return the correct key when getSendEditingTransactionId is truthy', function () { - assert.equal( + assert.strictEqual( getTitleKey( getMetamaskSendMockState({ to: true, @@ -474,7 +477,7 @@ describe('send selectors', function () { }) it('should return the correct key when getSendEditingTransactionId is falsy and getSendToken is truthy', function () { - assert.equal( + assert.strictEqual( getTitleKey( getMetamaskSendMockState({ to: true, @@ -487,7 +490,7 @@ describe('send selectors', function () { }) it('should return the correct key when getSendEditingTransactionId is falsy and getSendToken is falsy', function () { - assert.equal( + assert.strictEqual( getTitleKey( getMetamaskSendMockState({ to: true, @@ -510,7 +513,7 @@ describe('send selectors', function () { describe('isSendFormInError()', function () { it('should return true if any of the values of the object returned by getSendErrors are truthy', function () { - assert.equal( + assert.strictEqual( isSendFormInError( getSendMockState({ errors: [true], @@ -521,7 +524,7 @@ describe('send selectors', function () { }) it('should return false if all of the values of the object returned by getSendErrors are falsy', function () { - assert.equal( + assert.strictEqual( isSendFormInError( getSendMockState({ errors: [], @@ -529,7 +532,7 @@ describe('send selectors', function () { ), false, ) - assert.equal( + assert.strictEqual( isSendFormInError( getSendMockState({ errors: [false], diff --git a/ui/app/selectors/tests/transactions.test.js b/ui/app/selectors/tests/transactions.test.js index 6964ad161..593055392 100644 --- a/ui/app/selectors/tests/transactions.test.js +++ b/ui/app/selectors/tests/transactions.test.js @@ -35,7 +35,7 @@ describe('Transaction Selectors', function () { const msgSelector = unapprovedMessagesSelector(state) assert(Array.isArray(msgSelector)) - assert.deepEqual(msgSelector, [msg]) + assert.deepStrictEqual(msgSelector, [msg]) }) it('returns personal sign from unapprovedPersonalMsgsSelector', function () { @@ -62,7 +62,7 @@ describe('Transaction Selectors', function () { const msgSelector = unapprovedMessagesSelector(state) assert(Array.isArray(msgSelector)) - assert.deepEqual(msgSelector, [msg]) + assert.deepStrictEqual(msgSelector, [msg]) }) it('returns typed message from unapprovedTypedMessagesSelector', function () { @@ -90,7 +90,7 @@ describe('Transaction Selectors', function () { const msgSelector = unapprovedMessagesSelector(state) assert(Array.isArray(msgSelector)) - assert.deepEqual(msgSelector, [msg]) + assert.deepStrictEqual(msgSelector, [msg]) }) }) @@ -133,7 +133,7 @@ describe('Transaction Selectors', function () { const selectedTx = transactionsSelector(state) assert(Array.isArray(selectedTx)) - assert.deepEqual(selectedTx, orderedTxList) + assert.deepStrictEqual(selectedTx, orderedTxList) }) }) @@ -191,7 +191,10 @@ describe('Transaction Selectors', function () { }, ] - assert.deepEqual(nonceSortedTransactionsSelector(state), expectedResult) + assert.deepStrictEqual( + nonceSortedTransactionsSelector(state), + expectedResult, + ) }) }) @@ -286,7 +289,7 @@ describe('Transaction Selectors', function () { }, ] - assert.deepEqual( + assert.deepStrictEqual( nonceSortedPendingTransactionsSelector(state), expectedResult, ) @@ -304,7 +307,7 @@ describe('Transaction Selectors', function () { }, ] - assert.deepEqual( + assert.deepStrictEqual( nonceSortedCompletedTransactionsSelector(state), expectedResult, ) @@ -312,7 +315,7 @@ describe('Transaction Selectors', function () { it('submittedPendingTransactionsSelector', function () { const expectedResult = [submittedTx] - assert.deepEqual( + assert.deepStrictEqual( submittedPendingTransactionsSelector(state), expectedResult, )