Use strict equality in unit tests (#9966)

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent dd3f728e82
commit 42fd8b0ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      ui/app/components/app/account-list-item/tests/account-list-item-component.test.js
  2. 36
      ui/app/components/app/account-menu/tests/account-menu.test.js
  3. 13
      ui/app/components/app/alerts/unconnected-account-alert/tests/unconnected-account-alert.test.js
  4. 4
      ui/app/components/app/app-header/tests/app-header.test.js
  5. 14
      ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js
  6. 8
      ui/app/components/app/dropdowns/tests/dropdown.test.js
  7. 8
      ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js
  8. 20
      ui/app/components/app/dropdowns/tests/network-dropdown.test.js
  9. 28
      ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js
  10. 11
      ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js
  11. 20
      ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js
  12. 68
      ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js
  13. 4
      ui/app/components/app/info-box/tests/info-box.test.js
  14. 26
      ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js
  15. 52
      ui/app/components/app/modal/tests/modal.component.test.js
  16. 10
      ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js
  17. 28
      ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js
  18. 2
      ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js
  19. 5
      ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js
  20. 10
      ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js
  21. 4
      ui/app/components/app/modals/tests/account-details-modal.test.js
  22. 7
      ui/app/components/app/selected-account/tests/selected-account-component.test.js
  23. 14
      ui/app/components/app/sidebars/tests/sidebars-component.test.js
  24. 2
      ui/app/components/app/signature-request/tests/signature-request.test.js
  25. 22
      ui/app/components/app/token-cell/token-cell.test.js
  26. 4
      ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js
  27. 2
      ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js
  28. 11
      ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.util.test.js
  29. 6
      ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js
  30. 10
      ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js
  31. 12
      ui/app/components/app/transaction-status/tests/transaction-status.component.test.js
  32. 10
      ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js
  33. 8
      ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js
  34. 2
      ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js
  35. 8
      ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js
  36. 2
      ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js
  37. 4
      ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js
  38. 6
      ui/app/components/ui/alert/tests/alert.test.js
  39. 10
      ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js
  40. 41
      ui/app/components/ui/button-group/tests/button-group-component.test.js
  41. 4
      ui/app/components/ui/card/tests/card.component.test.js
  42. 4
      ui/app/components/ui/currency-display/tests/currency-display.component.test.js
  43. 136
      ui/app/components/ui/currency-input/tests/currency-input.component.test.js
  44. 4
      ui/app/components/ui/currency-input/tests/currency-input.container.test.js
  45. 12
      ui/app/components/ui/error-message/tests/error-message.component.test.js
  46. 4
      ui/app/components/ui/hex-to-decimal/tests/hex-to-decimal.component.test.js
  47. 8
      ui/app/components/ui/identicon/tests/identicon.component.test.js
  48. 14
      ui/app/components/ui/list-item/tests/list-item.test.js
  49. 12
      ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js
  50. 23
      ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js
  51. 31
      ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js
  52. 111
      ui/app/components/ui/token-input/tests/token-input.component.test.js
  53. 34
      ui/app/components/ui/unit-input/tests/unit-input.component.test.js
  54. 83
      ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js
  55. 60
      ui/app/ducks/gas/gas-duck.test.js
  56. 30
      ui/app/ducks/send/send-duck.test.js
  57. 12
      ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js
  58. 2
      ui/app/helpers/utils/common.util.test.js
  59. 34
      ui/app/helpers/utils/confirm-tx.util.test.js
  60. 58
      ui/app/helpers/utils/conversion-util.test.js
  61. 12
      ui/app/helpers/utils/conversions.util.test.js
  62. 6
      ui/app/helpers/utils/fetch-with-cache.test.js
  63. 18
      ui/app/helpers/utils/i18n-helper.test.js
  64. 10
      ui/app/helpers/utils/transactions.util.test.js
  65. 57
      ui/app/helpers/utils/util.test.js
  66. 12
      ui/app/hooks/tests/useCancelTransaction.test.js
  67. 6
      ui/app/hooks/tests/useCurrencyDisplay.test.js
  68. 4
      ui/app/hooks/tests/useRetryTransaction.test.js
  69. 6
      ui/app/hooks/tests/useTokenData.test.js
  70. 2
      ui/app/hooks/tests/useTokenDisplayValue.test.js
  71. 24
      ui/app/hooks/tests/useTransactionDisplayData.test.js
  72. 4
      ui/app/hooks/tests/useUserPreferencedCurrency.test.js
  73. 15
      ui/app/pages/add-token/tests/add-token.test.js
  74. 10
      ui/app/pages/confirm-transaction-base/tests/confirm-transaction-base.component.test.js
  75. 12
      ui/app/pages/create-account/tests/create-account.test.js
  76. 21
      ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/tests/import-with-seed-phrase.component.test.js
  77. 2
      ui/app/pages/first-time-flow/end-of-flow/tests/end-of-flow.test.js
  78. 14
      ui/app/pages/first-time-flow/first-time-flow-switch/tests/first-time-flow-switch.test.js
  79. 10
      ui/app/pages/first-time-flow/seed-phrase/reveal-seed-phrase/tests/reveal-seed-phrase.test.js
  80. 20
      ui/app/pages/first-time-flow/seed-phrase/tests/confirm-seed-phrase-component.test.js
  81. 4
      ui/app/pages/first-time-flow/select-action/tests/select-action.test.js
  82. 4
      ui/app/pages/first-time-flow/welcome/tests/welcome.test.js
  83. 4
      ui/app/pages/lock/tests/lock.test.js
  84. 47
      ui/app/pages/send/send-content/add-recipient/tests/add-recipient-component.test.js
  85. 4
      ui/app/pages/send/send-content/add-recipient/tests/add-recipient-container.test.js
  86. 16
      ui/app/pages/send/send-content/add-recipient/tests/add-recipient-utils.test.js
  87. 20
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js
  88. 16
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-container.test.js
  89. 4
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-utils.test.js
  90. 30
      ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js
  91. 21
      ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-container.test.js
  92. 14
      ui/app/pages/send/send-content/send-gas-row/gas-fee-display/tests/gas-fee-display.component.test.js
  93. 34
      ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js
  94. 8
      ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-component.test.js
  95. 2
      ui/app/pages/send/send-content/send-row-wrapper/send-row-error-message/tests/send-row-error-message-container.test.js
  96. 20
      ui/app/pages/send/send-content/send-row-wrapper/tests/send-row-wrapper-component.test.js
  97. 14
      ui/app/pages/send/send-content/tests/send-content-component.test.js
  98. 44
      ui/app/pages/send/send-footer/tests/send-footer-component.test.js
  99. 31
      ui/app/pages/send/send-footer/tests/send-footer-container.test.js
  100. 16
      ui/app/pages/send/send-footer/tests/send-footer-utils.test.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -45,23 +45,23 @@ describe('AccountListItem Component', function () {
}) })
it('should render a div with the passed className', 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').is('div'))
assert(wrapper.find('.mockClassName').hasClass('account-list-item')) assert(wrapper.find('.mockClassName').hasClass('account-list-item'))
}) })
it('should call handleClick with the expected props when the root div is clicked', function () { it('should call handleClick with the expected props when the root div is clicked', function () {
const { onClick } = wrapper.find('.mockClassName').props() const { onClick } = wrapper.find('.mockClassName').props()
assert.equal(propsMethodSpies.handleClick.callCount, 0) assert.strictEqual(propsMethodSpies.handleClick.callCount, 0)
onClick() onClick()
assert.equal(propsMethodSpies.handleClick.callCount, 1) assert.strictEqual(propsMethodSpies.handleClick.callCount, 1)
assert.deepEqual(propsMethodSpies.handleClick.getCall(0).args, [ assert.deepStrictEqual(propsMethodSpies.handleClick.getCall(0).args, [
{ address: 'mockAddress', name: 'mockName', balance: 'mockBalance' }, { address: 'mockAddress', name: 'mockName', balance: 'mockBalance' },
]) ])
}) })
it('should have a top row div', function () { it('should have a top row div', function () {
assert.equal( assert.strictEqual(
wrapper.find('.mockClassName > .account-list-item__top-row').length, wrapper.find('.mockClassName > .account-list-item__top-row').length,
1, 1,
) )
@ -74,16 +74,19 @@ describe('AccountListItem Component', function () {
const topRow = wrapper.find( const topRow = wrapper.find(
'.mockClassName > .account-list-item__top-row', '.mockClassName > .account-list-item__top-row',
) )
assert.equal(topRow.find(Identicon).length, 1) assert.strictEqual(topRow.find(Identicon).length, 1)
assert.equal(topRow.find('.account-list-item__account-name').length, 1) assert.strictEqual(
assert.equal(topRow.find('.account-list-item__icon').length, 1) 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 () { it('should show the account name if it exists', function () {
const topRow = wrapper.find( const topRow = wrapper.find(
'.mockClassName > .account-list-item__top-row', '.mockClassName > .account-list-item__top-row',
) )
assert.equal( assert.strictEqual(
topRow.find('.account-list-item__account-name').text(), topRow.find('.account-list-item__account-name').text(),
'mockName', 'mockName',
) )
@ -94,7 +97,7 @@ describe('AccountListItem Component', function () {
const topRow = wrapper.find( const topRow = wrapper.find(
'.mockClassName > .account-list-item__top-row', '.mockClassName > .account-list-item__top-row',
) )
assert.equal( assert.strictEqual(
topRow.find('.account-list-item__account-name').text(), topRow.find('.account-list-item__account-name').text(),
'addressButNoName', 'addressButNoName',
) )
@ -115,25 +118,27 @@ describe('AccountListItem Component', function () {
const topRow = wrapper.find( const topRow = wrapper.find(
'.mockClassName > .account-list-item__top-row', '.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 () { it('should render the account address as a checksumAddress if displayAddress is true and name is provided', function () {
wrapper.setProps({ displayAddress: true }) wrapper.setProps({ displayAddress: true })
assert.equal( assert.strictEqual(
wrapper.find('.account-list-item__account-address').length, wrapper.find('.account-list-item__account-address').length,
1, 1,
) )
assert.equal( assert.strictEqual(
wrapper.find('.account-list-item__account-address').text(), wrapper.find('.account-list-item__account-address').text(),
'mockCheckSumAddress', '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 () { it('should not render the account address as a checksumAddress if displayAddress is false', function () {
wrapper.setProps({ displayAddress: false }) wrapper.setProps({ displayAddress: false })
assert.equal( assert.strictEqual(
wrapper.find('.account-list-item__account-address').length, wrapper.find('.account-list-item__account-address').length,
0, 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 () { it('should not render the account address as a checksumAddress if name is not provided', function () {
wrapper.setProps({ account: { address: 'someAddressButNoName' } }) wrapper.setProps({ account: { address: 'someAddressButNoName' } })
assert.equal( assert.strictEqual(
wrapper.find('.account-list-item__account-address').length, wrapper.find('.account-list-item__account-address').length,
0, 0,
) )

@ -74,14 +74,14 @@ describe('Account Menu', function () {
describe('Render Content', function () { describe('Render Content', function () {
it('returns account name from identities', function () { it('returns account name from identities', function () {
const accountName = wrapper.find('.account-menu__name') 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 () { it('renders user preference currency display balance from account balance', function () {
const accountBalance = wrapper.find( const accountBalance = wrapper.find(
'.currency-display-component.account-menu__balance', '.currency-display-component.account-menu__balance',
) )
assert.equal(accountBalance.length, 2) assert.strictEqual(accountBalance.length, 2)
}) })
it('simulate click', function () { it('simulate click', function () {
@ -91,12 +91,15 @@ describe('Account Menu', function () {
click.first().simulate('click') click.first().simulate('click')
assert(props.showAccountDetail.calledOnce) 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 () { it('render imported account label', function () {
const importedAccount = wrapper.find('.keyring-label.allcaps') 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 () { it('logout', function () {
logout = wrapper.find('.account-menu__lock-button') logout = wrapper.find('.account-menu__lock-button')
assert.equal(logout.length, 1) assert.strictEqual(logout.length, 1)
}) })
it('simulate click', function () { it('simulate click', function () {
logout.simulate('click') logout.simulate('click')
assert(props.lockMetamask.calledOnce) 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 () { it('renders create account item', function () {
createAccount = wrapper.find({ text: 'createAccount' }) 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 () { it('calls toggle menu and push new-account route to history', function () {
createAccount.simulate('click') createAccount.simulate('click')
assert(props.toggleAccountMenu.calledOnce) 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 () { it('renders import account item', function () {
importAccount = wrapper.find({ text: 'importAccount' }) 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 () { 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 () { it('renders import account item', function () {
connectHardwareWallet = wrapper.find({ text: 'connectHardwareWallet' }) 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 () { it('calls toggle menu and push /new-account/connect route to history', function () {
connectHardwareWallet.simulate('click') connectHardwareWallet.simulate('click')
assert(props.toggleAccountMenu.calledOnce) assert(props.toggleAccountMenu.calledOnce)
assert.equal( assert.strictEqual(
props.history.push.getCall(0).args[0], props.history.push.getCall(0).args[0],
'/new-account/connect', '/new-account/connect',
) )
@ -168,13 +171,16 @@ describe('Account Menu', function () {
it('renders import account item', function () { it('renders import account item', function () {
infoHelp = wrapper.find({ text: 'infoHelp' }) 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 () { it('calls toggle menu and push /new-account/connect route to history', function () {
infoHelp.simulate('click') infoHelp.simulate('click')
assert(props.toggleAccountMenu.calledOnce) 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 () { it('renders import account item', function () {
settings = wrapper.find({ text: 'settings' }) 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 () { it('calls toggle menu and push /new-account/connect route to history', function () {
settings.simulate('click') settings.simulate('click')
assert(props.toggleAccountMenu.calledOnce) assert(props.toggleAccountMenu.calledOnce)
assert.equal(props.history.push.getCall(0).args[0], '/settings') assert.strictEqual(props.history.push.getCall(0).args[0], '/settings')
}) })
}) })
}) })

@ -115,9 +115,9 @@ describe('Unconnected Account Alert', function () {
const dontShowCheckbox = getByRole('checkbox') const dontShowCheckbox = getByRole('checkbox')
assert.equal(dontShowCheckbox.checked, false) assert.strictEqual(dontShowCheckbox.checked, false)
fireEvent.click(dontShowCheckbox) fireEvent.click(dontShowCheckbox)
assert.equal(dontShowCheckbox.checked, true) assert.strictEqual(dontShowCheckbox.checked, true)
}) })
it('clicks dismiss button and calls dismissAlert action', function () { it('clicks dismiss button and calls dismissAlert action', function () {
@ -128,7 +128,10 @@ describe('Unconnected Account Alert', function () {
const dismissButton = getByText(/dismiss/u) const dismissButton = getByText(/dismiss/u)
fireEvent.click(dismissButton) 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 () { 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) fireEvent.click(dismissButton)
setImmediate(() => { setImmediate(() => {
assert.equal( assert.strictEqual(
store.getActions()[0].type, store.getActions()[0].type,
'unconnectedAccount/disableAlertRequested', 'unconnectedAccount/disableAlertRequested',
) )
assert.equal( assert.strictEqual(
store.getActions()[1].type, store.getActions()[1].type,
'unconnectedAccount/disableAlertSucceeded', 'unconnectedAccount/disableAlertSucceeded',
) )

@ -43,7 +43,7 @@ describe('App Header', function () {
const appLogo = wrapper.find(MetaFoxLogo) const appLogo = wrapper.find(MetaFoxLogo)
appLogo.simulate('click') appLogo.simulate('click')
assert(props.history.push.calledOnce) 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 () { it('hides network indicator', function () {
wrapper.setProps({ hideNetworkIndicator: true }) wrapper.setProps({ hideNetworkIndicator: true })
const network = wrapper.find({ network: 'test' }) const network = wrapper.find({ network: 'test' })
assert.equal(network.length, 0) assert.strictEqual(network.length, 0)
}) })
}) })

@ -29,11 +29,11 @@ describe('Confirm Detail Row Component', function () {
}) })
it('should render a div with a confirm-detail-row class', 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 () { it('should render the label as a child of the confirm-detail-row__label', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.confirm-detail-row > .confirm-detail-row__label') .find('.confirm-detail-row > .confirm-detail-row__label')
.childAt(0) .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 () { it('should render the headerText as a child of the confirm-detail-row__header-text', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find( .find(
'.confirm-detail-row__details > .confirm-detail-row__header-text', '.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 () { it('should render the primaryText as a child of the confirm-detail-row__primary', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.confirm-detail-row__details > .confirm-detail-row__primary') .find('.confirm-detail-row__details > .confirm-detail-row__primary')
.childAt(0) .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 () { it('should render the ethText as a child of the confirm-detail-row__secondary', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.confirm-detail-row__details > .confirm-detail-row__secondary') .find('.confirm-detail-row__details > .confirm-detail-row__secondary')
.childAt(0) .childAt(0)
@ -75,14 +75,14 @@ describe('Confirm Detail Row Component', function () {
}) })
it('should set the fiatTextColor on confirm-detail-row__primary', 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, wrapper.find('.confirm-detail-row__primary').props().style.color,
'mockColor', 'mockColor',
) )
}) })
it('should assure the confirm-detail-row__header-text classname is correct', function () { 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, wrapper.find('.confirm-detail-row__header-text').props().className,
'confirm-detail-row__header-text mockHeaderClass', 'confirm-detail-row__header-text mockHeaderClass',
) )

@ -20,16 +20,16 @@ describe('Dropdown', function () {
}) })
it('renders li with dropdown-menu-item class', 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 () { 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 () { it('simulates click event and calls onClick and closeMenu', function () {
wrapper.prop('onClick')() wrapper.prop('onClick')()
assert.equal(onClickSpy.callCount, 1) assert.strictEqual(onClickSpy.callCount, 1)
assert.equal(closeMenuSpy.callCount, 1) assert.strictEqual(closeMenuSpy.callCount, 1)
}) })
}) })

@ -14,9 +14,9 @@ describe('Network Dropdown Icon', function () {
/>, />,
) )
const styleProp = wrapper.find('.menu-icon-circle').children().prop('style') const styleProp = wrapper.find('.menu-icon-circle').children().prop('style')
assert.equal(styleProp.background, 'red') assert.strictEqual(styleProp.background, 'red')
assert.equal(styleProp.border, 'none') assert.strictEqual(styleProp.border, 'none')
assert.equal(styleProp.height, '12px') assert.strictEqual(styleProp.height, '12px')
assert.equal(styleProp.width, '12px') assert.strictEqual(styleProp.width, '12px')
}) })
}) })

@ -31,11 +31,11 @@ describe('Network Dropdown', function () {
}) })
it('checks for network droppo class', 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 () { 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 () { 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 () { it('checks background color for first NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(0).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(0).prop('backgroundColor'),
'#29B6AF', '#29B6AF',
) // Ethereum Mainnet Teal ) // Ethereum Mainnet Teal
}) })
it('checks background color for second NetworkDropdownIcon', function () { it('checks background color for second NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(1).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(1).prop('backgroundColor'),
'#ff4a8d', '#ff4a8d',
) // Ropsten Red ) // Ropsten Red
}) })
it('checks background color for third NetworkDropdownIcon', function () { it('checks background color for third NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(2).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(2).prop('backgroundColor'),
'#7057ff', '#7057ff',
) // Kovan Purple ) // Kovan Purple
}) })
it('checks background color for fourth NetworkDropdownIcon', function () { it('checks background color for fourth NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(3).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(3).prop('backgroundColor'),
'#f6c343', '#f6c343',
) // Rinkeby Yellow ) // Rinkeby Yellow
}) })
it('checks background color for fifth NetworkDropdownIcon', function () { it('checks background color for fifth NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(4).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(4).prop('backgroundColor'),
'#3099f2', '#3099f2',
) // Goerli Blue ) // Goerli Blue
}) })
it('checks background color for sixth NetworkDropdownIcon', function () { it('checks background color for sixth NetworkDropdownIcon', function () {
assert.equal( assert.strictEqual(
wrapper.find(NetworkDropdownIcon).at(5).prop('backgroundColor'), wrapper.find(NetworkDropdownIcon).at(5).prop('backgroundColor'),
'#d6d9dc', '#d6d9dc',
) // "Custom network grey" ) // "Custom network grey"
}) })
it('checks dropdown for frequestRPCList from state', function () { it('checks dropdown for frequestRPCList from state', function () {
assert.equal( assert.strictEqual(
wrapper.find(DropdownMenuItem).at(6).text(), wrapper.find(DropdownMenuItem).at(6).text(),
'✓http://localhost:7545', '✓http://localhost:7545',
) )

@ -40,7 +40,7 @@ describe('Advanced Gas Inputs', function () {
wrapper.find('input').at(0).simulate('change', event) wrapper.find('input').at(0).simulate('change', event)
clock.tick(499) clock.tick(499)
assert.equal(props.updateCustomGasPrice.callCount, 0) assert.strictEqual(props.updateCustomGasPrice.callCount, 0)
}) })
it('simulates onChange on gas price after debounce', function () { 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) wrapper.find('input').at(0).simulate('change', event)
clock.tick(500) clock.tick(500)
assert.equal(props.updateCustomGasPrice.calledOnce, true) assert.strictEqual(props.updateCustomGasPrice.calledOnce, true)
assert.equal(props.updateCustomGasPrice.calledWith(1), true) assert.strictEqual(props.updateCustomGasPrice.calledWith(1), true)
}) })
it('wont update gasLimit in props before debounce', function () { 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) wrapper.find('input').at(1).simulate('change', event)
clock.tick(499) clock.tick(499)
assert.equal(props.updateCustomGasLimit.callCount, 0) assert.strictEqual(props.updateCustomGasLimit.callCount, 0)
}) })
it('simulates onChange on gas limit after debounce', function () { 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) wrapper.find('input').at(1).simulate('change', event)
clock.tick(500) clock.tick(500)
assert.equal(props.updateCustomGasLimit.calledOnce, true) assert.strictEqual(props.updateCustomGasLimit.calledOnce, true)
assert.equal(props.updateCustomGasLimit.calledWith(21000), true) assert.strictEqual(props.updateCustomGasLimit.calledWith(21000), true)
}) })
it('errors when insufficientBalance under gas price and gas limit', function () { it('errors when insufficientBalance under gas price and gas limit', function () {
@ -77,10 +77,10 @@ describe('Advanced Gas Inputs', function () {
const renderError = wrapper.find( const renderError = wrapper.find(
'.advanced-gas-inputs__gas-edit-row__error-text', '.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.strictEqual(renderError.at(0).text(), 'insufficientBalance')
assert.equal(renderError.at(1).text(), 'insufficientBalance') assert.strictEqual(renderError.at(1).text(), 'insufficientBalance')
}) })
it('errors zero gas price / speed up', function () { it('errors zero gas price / speed up', function () {
@ -89,10 +89,10 @@ describe('Advanced Gas Inputs', function () {
const renderError = wrapper.find( const renderError = wrapper.find(
'.advanced-gas-inputs__gas-edit-row__error-text', '.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.strictEqual(renderError.at(0).text(), 'zeroGasPriceOnSpeedUpError')
assert.equal(renderError.at(1).text(), 'gasLimitTooLowWithDynamicFee') assert.strictEqual(renderError.at(1).text(), 'gasLimitTooLowWithDynamicFee')
}) })
it('warns when custom gas price is too low', function () { it('warns when custom gas price is too low', function () {
@ -101,8 +101,8 @@ describe('Advanced Gas Inputs', function () {
const renderWarning = wrapper.find( const renderWarning = wrapper.find(
'.advanced-gas-inputs__gas-edit-row__warning-text', '.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')
}) })
}) })

@ -39,7 +39,7 @@ describe('AdvancedTabContent Component', function () {
it('should render the expected child of the advanced-tab div', function () { it('should render the expected child of the advanced-tab div', function () {
const advancedTabChildren = wrapper.children() const advancedTabChildren = wrapper.children()
assert.equal(advancedTabChildren.length, 2) assert.strictEqual(advancedTabChildren.length, 2)
assert( assert(
advancedTabChildren advancedTabChildren
@ -52,7 +52,7 @@ describe('AdvancedTabContent Component', function () {
const renderDataSummaryArgs = AdvancedTabContent.prototype.renderDataSummary.getCall( const renderDataSummaryArgs = AdvancedTabContent.prototype.renderDataSummary.getCall(
0, 0,
).args ).args
assert.deepEqual(renderDataSummaryArgs, ['$0.25']) assert.deepStrictEqual(renderDataSummaryArgs, ['$0.25'])
}) })
}) })
@ -74,7 +74,10 @@ describe('AdvancedTabContent Component', function () {
assert( assert(
titlesNode.hasClass('advanced-tab__transaction-data-summary__titles'), 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 () { it('should render the data', function () {
@ -82,7 +85,7 @@ describe('AdvancedTabContent Component', function () {
assert( assert(
dataNode.hasClass('advanced-tab__transaction-data-summary__container'), dataNode.hasClass('advanced-tab__transaction-data-summary__container'),
) )
assert.equal(dataNode.children().at(0).text(), 'mockTotalFee') assert.strictEqual(dataNode.children().at(0).text(), 'mockTotalFee')
}) })
}) })
}) })

@ -60,7 +60,7 @@ describe('BasicTabContent Component', function () {
}) })
it('should render a GasPriceButtonGroup compenent', 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 () { it('should pass correct props to GasPriceButtonGroup', function () {
@ -72,22 +72,22 @@ describe('BasicTabContent Component', function () {
noButtonActiveByDefault, noButtonActiveByDefault,
showCheck, showCheck,
} = wrapper.find(GasPriceButtonGroup).props() } = wrapper.find(GasPriceButtonGroup).props()
assert.equal(wrapper.find(GasPriceButtonGroup).length, 1) assert.strictEqual(wrapper.find(GasPriceButtonGroup).length, 1)
assert.equal( assert.strictEqual(
buttonDataLoading, buttonDataLoading,
mockGasPriceButtonGroupProps.buttonDataLoading, mockGasPriceButtonGroupProps.buttonDataLoading,
) )
assert.equal(className, mockGasPriceButtonGroupProps.className) assert.strictEqual(className, mockGasPriceButtonGroupProps.className)
assert.equal( assert.strictEqual(
noButtonActiveByDefault, noButtonActiveByDefault,
mockGasPriceButtonGroupProps.noButtonActiveByDefault, mockGasPriceButtonGroupProps.noButtonActiveByDefault,
) )
assert.equal(showCheck, mockGasPriceButtonGroupProps.showCheck) assert.strictEqual(showCheck, mockGasPriceButtonGroupProps.showCheck)
assert.deepEqual( assert.deepStrictEqual(
gasButtonInfo, gasButtonInfo,
mockGasPriceButtonGroupProps.gasButtonInfo, mockGasPriceButtonGroupProps.gasButtonInfo,
) )
assert.equal( assert.strictEqual(
JSON.stringify(handleGasPriceSelection), JSON.stringify(handleGasPriceSelection),
JSON.stringify(mockGasPriceButtonGroupProps.handleGasPriceSelection), JSON.stringify(mockGasPriceButtonGroupProps.handleGasPriceSelection),
) )
@ -101,8 +101,8 @@ describe('BasicTabContent Component', function () {
}, },
}) })
assert.equal(wrapper.find(GasPriceButtonGroup).length, 0) assert.strictEqual(wrapper.find(GasPriceButtonGroup).length, 0)
assert.equal(wrapper.find(Loading).length, 1) assert.strictEqual(wrapper.find(Loading).length, 1)
}) })
}) })
}) })

@ -88,31 +88,31 @@ describe('GasModalPageContainer Component', function () {
describe('componentDidMount', function () { describe('componentDidMount', function () {
it('should call props.fetchBasicGasEstimates', function () { it('should call props.fetchBasicGasEstimates', function () {
propsMethodSpies.fetchBasicGasEstimates.resetHistory() propsMethodSpies.fetchBasicGasEstimates.resetHistory()
assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 0) assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 0)
wrapper.instance().componentDidMount() wrapper.instance().componentDidMount()
assert.equal(propsMethodSpies.fetchBasicGasEstimates.callCount, 1) assert.strictEqual(propsMethodSpies.fetchBasicGasEstimates.callCount, 1)
}) })
}) })
describe('render', function () { describe('render', function () {
it('should render a PageContainer compenent', 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 () { it('should pass correct props to PageContainer', function () {
const { title, subtitle, disabled } = wrapper.find(PageContainer).props() const { title, subtitle, disabled } = wrapper.find(PageContainer).props()
assert.equal(title, 'customGas') assert.strictEqual(title, 'customGas')
assert.equal(subtitle, 'customGasSubTitle') assert.strictEqual(subtitle, 'customGasSubTitle')
assert.equal(disabled, false) assert.strictEqual(disabled, false)
}) })
it('should pass the correct onCancel and onClose methods to PageContainer', function () { it('should pass the correct onCancel and onClose methods to PageContainer', function () {
const { onCancel, onClose } = wrapper.find(PageContainer).props() const { onCancel, onClose } = wrapper.find(PageContainer).props()
assert.equal(propsMethodSpies.cancelAndClose.callCount, 0) assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 0)
onCancel() onCancel()
assert.equal(propsMethodSpies.cancelAndClose.callCount, 1) assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 1)
onClose() onClose()
assert.equal(propsMethodSpies.cancelAndClose.callCount, 2) assert.strictEqual(propsMethodSpies.cancelAndClose.callCount, 2)
}) })
it('should pass the correct renderTabs property to PageContainer', function () { it('should pass the correct renderTabs property to PageContainer', function () {
@ -127,7 +127,7 @@ describe('GasModalPageContainer Component', function () {
const { tabsComponent } = renderTabsWrapperTester const { tabsComponent } = renderTabsWrapperTester
.find(PageContainer) .find(PageContainer)
.props() .props()
assert.equal(tabsComponent, 'mockTabs') assert.strictEqual(tabsComponent, 'mockTabs')
GasModalPageContainer.prototype.renderTabs.restore() GasModalPageContainer.prototype.renderTabs.restore()
}) })
}) })
@ -148,32 +148,38 @@ describe('GasModalPageContainer Component', function () {
it('should render a Tabs component with "Basic" and "Advanced" tabs', function () { it('should render a Tabs component with "Basic" and "Advanced" tabs', function () {
const renderTabsResult = wrapper.instance().renderTabs() const renderTabsResult = wrapper.instance().renderTabs()
const renderedTabs = shallow(renderTabsResult) const renderedTabs = shallow(renderTabsResult)
assert.equal(renderedTabs.props().className, 'tabs') assert.strictEqual(renderedTabs.props().className, 'tabs')
const tabs = renderedTabs.find(Tab) const tabs = renderedTabs.find(Tab)
assert.equal(tabs.length, 2) assert.strictEqual(tabs.length, 2)
assert.equal(tabs.at(0).props().name, 'basic') assert.strictEqual(tabs.at(0).props().name, 'basic')
assert.equal(tabs.at(1).props().name, 'advanced') assert.strictEqual(tabs.at(1).props().name, 'advanced')
assert.equal(tabs.at(0).childAt(0).props().className, 'gas-modal-content') assert.strictEqual(
assert.equal(tabs.at(1).childAt(0).props().className, 'gas-modal-content') 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 () { it('should call renderInfoRows with the expected props', function () {
assert.equal(GP.renderInfoRows.callCount, 0) assert.strictEqual(GP.renderInfoRows.callCount, 0)
wrapper.instance().renderTabs() 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', 'mockNewTotalFiat',
'mockNewTotalEth', 'mockNewTotalEth',
'mockSendAmount', 'mockSendAmount',
'mockTransactionFee', 'mockTransactionFee',
]) ])
assert.deepEqual(GP.renderInfoRows.getCall(1).args, [ assert.deepStrictEqual(GP.renderInfoRows.getCall(1).args, [
'mockNewTotalFiat', 'mockNewTotalFiat',
'mockNewTotalEth', 'mockNewTotalEth',
'mockSendAmount', 'mockSendAmount',
@ -202,8 +208,8 @@ describe('GasModalPageContainer Component', function () {
const renderedTabs = shallow(renderTabsResult) const renderedTabs = shallow(renderTabsResult)
const tabs = renderedTabs.find(Tab) const tabs = renderedTabs.find(Tab)
assert.equal(tabs.length, 1) assert.strictEqual(tabs.length, 1)
assert.equal(tabs.at(0).props().name, 'advanced') assert.strictEqual(tabs.at(0).props().name, 'advanced')
}) })
}) })
@ -213,7 +219,7 @@ describe('GasModalPageContainer Component', function () {
.instance() .instance()
.renderBasicTabContent(mockGasPriceButtonGroupProps) .renderBasicTabContent(mockGasPriceButtonGroupProps)
assert.deepEqual( assert.deepStrictEqual(
renderBasicTabContentResult.props.gasPriceButtonGroupProps, renderBasicTabContentResult.props.gasPriceButtonGroupProps,
mockGasPriceButtonGroupProps, mockGasPriceButtonGroupProps,
) )
@ -237,7 +243,7 @@ describe('GasModalPageContainer Component', function () {
assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName)) assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName))
const renderedInfoRows = renderedInfoRowsContainer.childAt(0).children() 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(0).hasClass(`${baseClassName}__send-info`))
assert( assert(
renderedInfoRows.at(1).hasClass(`${baseClassName}__transaction-info`), renderedInfoRows.at(1).hasClass(`${baseClassName}__transaction-info`),
@ -247,13 +253,19 @@ describe('GasModalPageContainer Component', function () {
renderedInfoRows.at(3).hasClass(`${baseClassName}__fiat-total-info`), renderedInfoRows.at(3).hasClass(`${baseClassName}__fiat-total-info`),
) )
assert.equal(renderedInfoRows.at(0).text(), 'sendAmount mockSendAmount') assert.strictEqual(
assert.equal( renderedInfoRows.at(0).text(),
'sendAmount mockSendAmount',
)
assert.strictEqual(
renderedInfoRows.at(1).text(), renderedInfoRows.at(1).text(),
'transactionFee mockTransactionFee', 'transactionFee mockTransactionFee',
) )
assert.equal(renderedInfoRows.at(2).text(), 'newTotal mockNewTotalEth') assert.strictEqual(
assert.equal(renderedInfoRows.at(3).text(), 'mockNewTotalFiat') renderedInfoRows.at(2).text(),
'newTotal mockNewTotalEth',
)
assert.strictEqual(renderedInfoRows.at(3).text(), 'mockNewTotalFiat')
}) })
}) })
}) })

@ -20,12 +20,12 @@ describe('InfoBox', function () {
it('renders title from props', function () { it('renders title from props', function () {
const title = wrapper.find('.info-box__title') 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 () { it('renders description from props', function () {
const description = wrapper.find('.info-box__description') const description = wrapper.find('.info-box__description')
assert.equal(description.text(), props.description) assert.strictEqual(description.text(), props.description)
}) })
it('closes info box', function () { it('closes info box', function () {

@ -7,17 +7,20 @@ describe('ModalContent Component', function () {
it('should render a title', function () { it('should render a title', function () {
const wrapper = shallow(<ModalContent title="Modal Title" />) const wrapper = shallow(<ModalContent title="Modal Title" />)
assert.equal(wrapper.find('.modal-content__title').length, 1) assert.strictEqual(wrapper.find('.modal-content__title').length, 1)
assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title') assert.strictEqual(
assert.equal(wrapper.find('.modal-content__description').length, 0) wrapper.find('.modal-content__title').text(),
'Modal Title',
)
assert.strictEqual(wrapper.find('.modal-content__description').length, 0)
}) })
it('should render a description', function () { it('should render a description', function () {
const wrapper = shallow(<ModalContent description="Modal Description" />) const wrapper = shallow(<ModalContent description="Modal Description" />)
assert.equal(wrapper.find('.modal-content__title').length, 0) assert.strictEqual(wrapper.find('.modal-content__title').length, 0)
assert.equal(wrapper.find('.modal-content__description').length, 1) assert.strictEqual(wrapper.find('.modal-content__description').length, 1)
assert.equal( assert.strictEqual(
wrapper.find('.modal-content__description').text(), wrapper.find('.modal-content__description').text(),
'Modal Description', 'Modal Description',
) )
@ -28,10 +31,13 @@ describe('ModalContent Component', function () {
<ModalContent title="Modal Title" description="Modal Description" />, <ModalContent title="Modal Title" description="Modal Description" />,
) )
assert.equal(wrapper.find('.modal-content__title').length, 1) assert.strictEqual(wrapper.find('.modal-content__title').length, 1)
assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title') assert.strictEqual(
assert.equal(wrapper.find('.modal-content__description').length, 1) wrapper.find('.modal-content__title').text(),
assert.equal( 'Modal Title',
)
assert.strictEqual(wrapper.find('.modal-content__description').length, 1)
assert.strictEqual(
wrapper.find('.modal-content__description').text(), wrapper.find('.modal-content__description').text(),
'Modal Description', 'Modal Description',
) )

@ -9,10 +9,10 @@ describe('Modal Component', function () {
it('should render a modal with a submit button', function () { it('should render a modal with a submit button', function () {
const wrapper = shallow(<Modal />) const wrapper = shallow(<Modal />)
assert.equal(wrapper.find('.modal-container').length, 1) assert.strictEqual(wrapper.find('.modal-container').length, 1)
const buttons = wrapper.find(Button) const buttons = wrapper.find(Button)
assert.equal(buttons.length, 1) assert.strictEqual(buttons.length, 1)
assert.equal(buttons.at(0).props().type, 'secondary') assert.strictEqual(buttons.at(0).props().type, 'secondary')
}) })
it('should render a modal with a cancel and a submit button', function () { 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) const buttons = wrapper.find(Button)
assert.equal(buttons.length, 2) assert.strictEqual(buttons.length, 2)
const cancelButton = buttons.at(0) const cancelButton = buttons.at(0)
const submitButton = buttons.at(1) const submitButton = buttons.at(1)
assert.equal(cancelButton.props().type, 'default') assert.strictEqual(cancelButton.props().type, 'default')
assert.equal(cancelButton.props().children, 'Cancel') assert.strictEqual(cancelButton.props().children, 'Cancel')
assert.equal(handleCancel.callCount, 0) assert.strictEqual(handleCancel.callCount, 0)
cancelButton.simulate('click') cancelButton.simulate('click')
assert.equal(handleCancel.callCount, 1) assert.strictEqual(handleCancel.callCount, 1)
assert.equal(submitButton.props().type, 'secondary') assert.strictEqual(submitButton.props().type, 'secondary')
assert.equal(submitButton.props().children, 'Submit') assert.strictEqual(submitButton.props().children, 'Submit')
assert.equal(handleSubmit.callCount, 0) assert.strictEqual(handleSubmit.callCount, 0)
submitButton.simulate('click') submitButton.simulate('click')
assert.equal(handleSubmit.callCount, 1) assert.strictEqual(handleSubmit.callCount, 1)
}) })
it('should render a modal with different button types', function () { it('should render a modal with different button types', function () {
@ -58,9 +58,9 @@ describe('Modal Component', function () {
) )
const buttons = wrapper.find(Button) const buttons = wrapper.find(Button)
assert.equal(buttons.length, 2) assert.strictEqual(buttons.length, 2)
assert.equal(buttons.at(0).props().type, 'secondary') assert.strictEqual(buttons.at(0).props().type, 'secondary')
assert.equal(buttons.at(1).props().type, 'confirm') assert.strictEqual(buttons.at(1).props().type, 'confirm')
}) })
it('should render a modal with children', function () { it('should render a modal with children', function () {
@ -93,15 +93,15 @@ describe('Modal Component', function () {
) )
assert.ok(wrapper.find('.modal-container__header')) assert.ok(wrapper.find('.modal-container__header'))
assert.equal( assert.strictEqual(
wrapper.find('.modal-container__header-text').text(), wrapper.find('.modal-container__header-text').text(),
'My Header', 'My Header',
) )
assert.equal(handleCancel.callCount, 0) assert.strictEqual(handleCancel.callCount, 0)
assert.equal(handleSubmit.callCount, 0) assert.strictEqual(handleSubmit.callCount, 0)
wrapper.find('.modal-container__header-close').simulate('click') wrapper.find('.modal-container__header-close').simulate('click')
assert.equal(handleCancel.callCount, 1) assert.strictEqual(handleCancel.callCount, 1)
assert.equal(handleSubmit.callCount, 0) assert.strictEqual(handleSubmit.callCount, 0)
}) })
it('should disable the submit button if submitDisabled is true', function () { it('should disable the submit button if submitDisabled is true', function () {
@ -120,17 +120,17 @@ describe('Modal Component', function () {
) )
const buttons = wrapper.find(Button) const buttons = wrapper.find(Button)
assert.equal(buttons.length, 2) assert.strictEqual(buttons.length, 2)
const cancelButton = buttons.at(0) const cancelButton = buttons.at(0)
const submitButton = buttons.at(1) const submitButton = buttons.at(1)
assert.equal(handleCancel.callCount, 0) assert.strictEqual(handleCancel.callCount, 0)
cancelButton.simulate('click') cancelButton.simulate('click')
assert.equal(handleCancel.callCount, 1) assert.strictEqual(handleCancel.callCount, 1)
assert.equal(submitButton.props().disabled, true) assert.strictEqual(submitButton.props().disabled, true)
assert.equal(handleSubmit.callCount, 0) assert.strictEqual(handleSubmit.callCount, 0)
submitButton.simulate('click') submitButton.simulate('click')
assert.equal(handleSubmit.callCount, 0) assert.strictEqual(handleSubmit.callCount, 0)
}) })
}) })

@ -9,18 +9,18 @@ describe('CancelTransactionGasFee Component', function () {
const wrapper = shallow(<CancelTransactionGasFee value="0x3b9aca00" />) const wrapper = shallow(<CancelTransactionGasFee value="0x3b9aca00" />)
assert.ok(wrapper) 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 ethDisplay = wrapper.find(UserPreferencedCurrencyDisplay).at(0)
const fiatDisplay = wrapper.find(UserPreferencedCurrencyDisplay).at(1) const fiatDisplay = wrapper.find(UserPreferencedCurrencyDisplay).at(1)
assert.equal(ethDisplay.props().value, '0x3b9aca00') assert.strictEqual(ethDisplay.props().value, '0x3b9aca00')
assert.equal( assert.strictEqual(
ethDisplay.props().className, ethDisplay.props().className,
'cancel-transaction-gas-fee__eth', 'cancel-transaction-gas-fee__eth',
) )
assert.equal(fiatDisplay.props().value, '0x3b9aca00') assert.strictEqual(fiatDisplay.props().value, '0x3b9aca00')
assert.equal( assert.strictEqual(
fiatDisplay.props().className, fiatDisplay.props().className,
'cancel-transaction-gas-fee__fiat', 'cancel-transaction-gas-fee__fiat',
) )

@ -15,17 +15,17 @@ describe('CancelTransaction Component', function () {
}) })
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find(Modal).length, 1) assert.strictEqual(wrapper.find(Modal).length, 1)
assert.equal(wrapper.find(CancelTransactionGasFee).length, 1) assert.strictEqual(wrapper.find(CancelTransactionGasFee).length, 1)
assert.equal( assert.strictEqual(
wrapper.find(CancelTransactionGasFee).props().value, wrapper.find(CancelTransactionGasFee).props().value,
'0x1319718a5000', '0x1319718a5000',
) )
assert.equal( assert.strictEqual(
wrapper.find('.cancel-transaction__title').text(), wrapper.find('.cancel-transaction__title').text(),
'cancellationGasFee', 'cancellationGasFee',
) )
assert.equal( assert.strictEqual(
wrapper.find('.cancel-transaction__description').text(), wrapper.find('.cancel-transaction__description').text(),
'attemptToCancelDescription', 'attemptToCancelDescription',
) )
@ -47,19 +47,19 @@ describe('CancelTransaction Component', function () {
{ context: { t } }, { context: { t } },
) )
assert.equal(wrapper.find(Modal).length, 1) assert.strictEqual(wrapper.find(Modal).length, 1)
const modalProps = wrapper.find(Modal).props() const modalProps = wrapper.find(Modal).props()
assert.equal(modalProps.headerText, 'attemptToCancel') assert.strictEqual(modalProps.headerText, 'attemptToCancel')
assert.equal(modalProps.submitText, 'yesLetsTry') assert.strictEqual(modalProps.submitText, 'yesLetsTry')
assert.equal(modalProps.cancelText, 'nevermind') assert.strictEqual(modalProps.cancelText, 'nevermind')
assert.equal(createCancelTransactionSpy.callCount, 0) assert.strictEqual(createCancelTransactionSpy.callCount, 0)
assert.equal(hideModalSpy.callCount, 0) assert.strictEqual(hideModalSpy.callCount, 0)
await modalProps.onSubmit() await modalProps.onSubmit()
assert.equal(createCancelTransactionSpy.callCount, 1) assert.strictEqual(createCancelTransactionSpy.callCount, 1)
assert.equal(hideModalSpy.callCount, 1) assert.strictEqual(hideModalSpy.callCount, 1)
modalProps.onCancel() modalProps.onCancel()
assert.equal(hideModalSpy.callCount, 2) assert.strictEqual(hideModalSpy.callCount, 2)
}) })
}) })

@ -30,7 +30,7 @@ describe('Confirm Delete Network', function () {
it('renders delete network modal title', function () { it('renders delete network modal title', function () {
const modalTitle = wrapper.find('.modal-content__title') const modalTitle = wrapper.find('.modal-content__title')
assert.equal(modalTitle.text(), 'deleteNetwork') assert.strictEqual(modalTitle.text(), 'deleteNetwork')
}) })
it('clicks cancel to hide modal', function () { it('clicks cancel to hide modal', function () {

@ -61,7 +61,10 @@ describe('Confirm Remove Account', function () {
remove.simulate('click') remove.simulate('click')
assert(props.removeAccount.calledOnce) 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(() => { setImmediate(() => {
assert(props.hideModal.calledOnce) assert(props.hideModal.calledOnce)

@ -34,7 +34,10 @@ describe('MetaMetrics Opt In', function () {
setImmediate(() => { setImmediate(() => {
assert(props.setParticipateInMetaMetrics.calledOnce) 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) assert(props.hideModal.calledOnce)
done() done()
}) })
@ -48,7 +51,10 @@ describe('MetaMetrics Opt In', function () {
setImmediate(() => { setImmediate(() => {
assert(props.setParticipateInMetaMetrics.calledOnce) 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) assert(props.hideModal.calledOnce)
done() done()
}) })

@ -46,7 +46,7 @@ describe('Account Details Modal', function () {
accountLabel.simulate('submit', 'New Label') accountLabel.simulate('submit', 'New Label')
assert(props.setAccountLabel.calledOnce) 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 () { 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 modalButton = wrapper.find('.account-details-modal__button')
const blockExplorerLink = modalButton.first() const blockExplorerLink = modalButton.first()
assert.equal( assert.strictEqual(
blockExplorerLink.html(), blockExplorerLink.html(),
'<button class="button btn-secondary account-details-modal__button">blockExplorerView</button>', '<button class="button btn-secondary account-details-modal__button">blockExplorerView</button>',
) )

@ -15,10 +15,13 @@ describe('SelectedAccount Component', function () {
{ context: { t: () => undefined } }, { context: { t: () => undefined } },
) )
// Checksummed version of address is displayed // Checksummed version of address is displayed
assert.equal( assert.strictEqual(
wrapper.find('.selected-account__address').text(), wrapper.find('.selected-account__address').text(),
'0x1B82...5C9D', '0x1B82...5C9D',
) )
assert.equal(wrapper.find('.selected-account__name').text(), 'testName') assert.strictEqual(
wrapper.find('.selected-account__name').text(),
'testName',
)
}) })
}) })

@ -41,9 +41,9 @@ describe('Sidebar Component', function () {
}) })
it('should pass the correct onClick function to the element', 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() 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 () { it('should not render with an unrecognized type', function () {
wrapper.setProps({ type: 'foobar' }) wrapper.setProps({ type: 'foobar' })
renderSidebarContent = wrapper.instance().renderSidebarContent() renderSidebarContent = wrapper.instance().renderSidebarContent()
assert.equal(renderSidebarContent, undefined) assert.strictEqual(renderSidebarContent, null)
}) })
}) })
describe('render', function () { describe('render', function () {
it('should render a div with one child', function () { it('should render a div with one child', function () {
assert(wrapper.is('div')) 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 () { it('should render the ReactCSSTransitionGroup without any children', function () {
assert(wrapper.children().at(0).is(ReactCSSTransitionGroup)) 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 () { it('should render sidebar content and the overlay if sidebarOpen is true', function () {
wrapper.setProps({ sidebarOpen: true }) 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(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.children().at(0).children().at(0).hasClass('sidebar-left'))
assert( assert(
wrapper wrapper

@ -23,7 +23,7 @@ describe('Signature Request Component', function () {
) )
assert(wrapper.is('div')) assert(wrapper.is('div'))
assert.equal(wrapper.length, 1) assert.strictEqual(wrapper.length, 1)
assert(wrapper.hasClass('signature-request')) assert(wrapper.hasClass('signature-request'))
}) })
}) })

@ -64,20 +64,32 @@ describe('Token Cell', function () {
}) })
it('renders Identicon with props from token cell', function () { it('renders Identicon with props from token cell', function () {
assert.equal(wrapper.find(Identicon).prop('address'), '0xAnotherToken') assert.strictEqual(
assert.equal(wrapper.find(Identicon).prop('image'), './test-image') wrapper.find(Identicon).prop('address'),
'0xAnotherToken',
)
assert.strictEqual(wrapper.find(Identicon).prop('image'), './test-image')
}) })
it('renders token balance', function () { 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 () { 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 () { 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 () { it('calls onClick when clicked', function () {

@ -109,7 +109,7 @@ describe('TransactionActivityLog Component', function () {
assert.ok(wrapper.hasClass('transaction-activity-log')) assert.ok(wrapper.hasClass('transaction-activity-log'))
assert.ok(wrapper.hasClass('test-class')) assert.ok(wrapper.hasClass('test-class'))
assert.equal( assert.strictEqual(
wrapper.find('.transaction-activity-log__action-link').length, wrapper.find('.transaction-activity-log__action-link').length,
2, 2,
) )
@ -166,7 +166,7 @@ describe('TransactionActivityLog Component', function () {
assert.ok(wrapper.hasClass('transaction-activity-log')) assert.ok(wrapper.hasClass('transaction-activity-log'))
assert.ok(wrapper.hasClass('test-class')) assert.ok(wrapper.hasClass('test-class'))
assert.equal( assert.strictEqual(
wrapper.find('.transaction-activity-log__action-link').length, wrapper.find('.transaction-activity-log__action-link').length,
0, 0,
) )

@ -22,7 +22,7 @@ describe('TransactionActivityLog container', function () {
}, },
} }
assert.deepEqual(mapStateToProps(mockState), { assert.deepStrictEqual(mapStateToProps(mockState), {
conversionRate: 280.45, conversionRate: 280.45,
nativeCurrency: 'ETH', nativeCurrency: 'ETH',
}) })

@ -11,7 +11,7 @@ import {
describe('TransactionActivityLog utils', function () { describe('TransactionActivityLog utils', function () {
describe('combineTransactionHistories', function () { describe('combineTransactionHistories', function () {
it('should return no activities for an empty list of transactions', 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 () { 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 () { 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)
}) })
}) })
}) })

@ -14,11 +14,11 @@ describe('TransactionBreakdownRow Component', function () {
) )
assert.ok(wrapper.hasClass('transaction-breakdown-row')) assert.ok(wrapper.hasClass('transaction-breakdown-row'))
assert.equal( assert.strictEqual(
wrapper.find('.transaction-breakdown-row__title').text(), wrapper.find('.transaction-breakdown-row__title').text(),
'test', 'test',
) )
assert.equal( assert.strictEqual(
wrapper.find('.transaction-breakdown-row__value').text(), wrapper.find('.transaction-breakdown-row__value').text(),
'Test', 'Test',
) )
@ -33,7 +33,7 @@ describe('TransactionBreakdownRow Component', function () {
) )
assert.ok(wrapper.hasClass('transaction-breakdown-row')) assert.ok(wrapper.hasClass('transaction-breakdown-row'))
assert.equal( assert.strictEqual(
wrapper.find('.transaction-breakdown-row__title').text(), wrapper.find('.transaction-breakdown-row__title').text(),
'test', 'test',
) )

@ -44,10 +44,10 @@ describe('TransactionListItemDetails Component', function () {
) )
const child = wrapper.childAt(0) const child = wrapper.childAt(0)
assert.ok(child.hasClass('transaction-list-item-details')) assert.ok(child.hasClass('transaction-list-item-details'))
assert.equal(child.find(Button).length, 2) assert.strictEqual(child.find(Button).length, 2)
assert.equal(child.find(SenderToRecipient).length, 1) assert.strictEqual(child.find(SenderToRecipient).length, 1)
assert.equal(child.find(TransactionBreakdown).length, 1) assert.strictEqual(child.find(TransactionBreakdown).length, 1)
assert.equal(child.find(TransactionActivityLog).length, 1) assert.strictEqual(child.find(TransactionActivityLog).length, 1)
}) })
it('should render a retry button', function () { it('should render a retry button', function () {
@ -90,7 +90,7 @@ describe('TransactionListItemDetails Component', function () {
const child = wrapper.childAt(0) const child = wrapper.childAt(0)
assert.ok(child.hasClass('transaction-list-item-details')) 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 () { it('should disable the Copy Tx ID and View In Etherscan buttons when tx hash is missing', function () {

@ -17,7 +17,7 @@ describe('TransactionStatus Component', function () {
) )
assert.ok(wrapper) 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 () { it('should render PENDING properly when status is APPROVED', function () {
@ -30,8 +30,8 @@ describe('TransactionStatus Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.text(), 'PENDING') assert.strictEqual(wrapper.text(), 'PENDING')
assert.equal(wrapper.find(Tooltip).props().title, 'test-title') assert.strictEqual(wrapper.find(Tooltip).props().title, 'test-title')
}) })
it('should render PENDING properly', function () { it('should render PENDING properly', function () {
@ -40,7 +40,7 @@ describe('TransactionStatus Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.text(), 'PENDING') assert.strictEqual(wrapper.text(), 'PENDING')
}) })
it('should render QUEUED properly', function () { it('should render QUEUED properly', function () {
@ -51,7 +51,7 @@ describe('TransactionStatus Component', function () {
wrapper.find('.transaction-status--queued').length, wrapper.find('.transaction-status--queued').length,
'queued className not found', 'queued className not found',
) )
assert.equal(wrapper.text(), 'QUEUED') assert.strictEqual(wrapper.text(), 'QUEUED')
}) })
it('should render UNAPPROVED properly', function () { it('should render UNAPPROVED properly', function () {
@ -62,7 +62,7 @@ describe('TransactionStatus Component', function () {
wrapper.find('.transaction-status--unapproved').length, wrapper.find('.transaction-status--unapproved').length,
'unapproved className not found', 'unapproved className not found',
) )
assert.equal(wrapper.text(), 'UNAPPROVED') assert.strictEqual(wrapper.text(), 'UNAPPROVED')
}) })
after(function () { after(function () {

@ -19,7 +19,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
const wrapper = shallow(<UserPreferencedCurrencyDisplay />) const wrapper = shallow(<UserPreferencedCurrencyDisplay />)
assert.ok(wrapper) 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 () { it('should pass all props to the CurrencyDisplay child component', function () {
@ -28,10 +28,10 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find(CurrencyDisplay).length, 1) assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1)
assert.equal(wrapper.find(CurrencyDisplay).props().prop1, true) assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop1, true)
assert.equal(wrapper.find(CurrencyDisplay).props().prop2, 'test') assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop2, 'test')
assert.equal(wrapper.find(CurrencyDisplay).props().prop3, 1) assert.strictEqual(wrapper.find(CurrencyDisplay).props().prop3, 1)
}) })
afterEach(function () { afterEach(function () {
sinon.restore() sinon.restore()

@ -10,7 +10,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
const wrapper = shallow(<UserPreferencedCurrencyInput />) const wrapper = shallow(<UserPreferencedCurrencyInput />)
assert.ok(wrapper) 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 () { it('should render useFiat for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', function () {
@ -19,10 +19,10 @@ describe('UserPreferencedCurrencyInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find(CurrencyInput).length, 1) assert.strictEqual(wrapper.find(CurrencyInput).length, 1)
assert.equal(wrapper.find(CurrencyInput).props().useFiat, false) assert.strictEqual(wrapper.find(CurrencyInput).props().useFiat, false)
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false }) wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false })
assert.equal(wrapper.find(CurrencyInput).props().useFiat, true) assert.strictEqual(wrapper.find(CurrencyInput).props().useFiat, true)
}) })
}) })
}) })

@ -23,7 +23,7 @@ describe('UserPreferencedCurrencyInput container', function () {
}, },
} }
assert.deepEqual(mapStateToProps(mockState), { assert.deepStrictEqual(mapStateToProps(mockState), {
useNativeCurrencyAsPrimaryCurrency: true, useNativeCurrencyAsPrimaryCurrency: true,
}) })
}) })

@ -12,7 +12,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
) )
assert.ok(wrapper) 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 () { it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', function () {
@ -24,10 +24,10 @@ describe('UserPreferencedCurrencyInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find(TokenInput).length, 1) assert.strictEqual(wrapper.find(TokenInput).length, 1)
assert.equal(wrapper.find(TokenInput).props().showFiat, false) assert.strictEqual(wrapper.find(TokenInput).props().showFiat, false)
wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false }) wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false })
assert.equal(wrapper.find(TokenInput).props().showFiat, true) assert.strictEqual(wrapper.find(TokenInput).props().showFiat, true)
}) })
}) })
}) })

@ -23,7 +23,7 @@ describe('UserPreferencedTokenInput container', function () {
}, },
} }
assert.deepEqual(mapStateToProps(mockState), { assert.deepStrictEqual(mapStateToProps(mockState), {
useNativeCurrencyAsPrimaryCurrency: true, useNativeCurrencyAsPrimaryCurrency: true,
}) })
}) })

@ -20,11 +20,11 @@ describe('AccountMismatchWarning', function () {
}) })
it('renders nothing when the addresses match', function () { it('renders nothing when the addresses match', function () {
const wrapper = shallow(<AccountMismatchWarning address="mockedAddress" />) const wrapper = shallow(<AccountMismatchWarning address="mockedAddress" />)
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 () { it('renders a warning info icon when addresses do not match', function () {
const wrapper = shallow(<AccountMismatchWarning address="mockedAddress2" />) const wrapper = shallow(<AccountMismatchWarning address="mockedAddress2" />)
assert.equal(wrapper.find(InfoIcon).length, 1) assert.strictEqual(wrapper.find(InfoIcon).length, 1)
}) })
after(function () { after(function () {
sinon.restore() sinon.restore()

@ -13,7 +13,7 @@ describe('Alert', function () {
it('renders nothing with no visible boolean in state', function () { it('renders nothing with no visible boolean in state', function () {
const alert = wrapper.find('.global-alert') 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 () { it('renders when visible in state is true, and message', function () {
@ -22,10 +22,10 @@ describe('Alert', function () {
wrapper.setState({ visible: true, msg: errorMessage }) wrapper.setState({ visible: true, msg: errorMessage })
const alert = wrapper.find('.global-alert') const alert = wrapper.find('.global-alert')
assert.equal(alert.length, 1) assert.strictEqual(alert.length, 1)
const errorText = wrapper.find('.msg') const errorText = wrapper.find('.msg')
assert.equal(errorText.text(), errorMessage) assert.strictEqual(errorText.text(), errorMessage)
}) })
it('calls component method when componentWillReceiveProps is called', function () { it('calls component method when componentWillReceiveProps is called', function () {

@ -8,17 +8,17 @@ describe('Breadcrumbs Component', function () {
const wrapper = shallow(<Breadcrumbs currentIndex={1} total={3} />) const wrapper = shallow(<Breadcrumbs currentIndex={1} total={3} />)
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.breadcrumbs').length, 1) assert.strictEqual(wrapper.find('.breadcrumbs').length, 1)
assert.equal(wrapper.find('.breadcrumb').length, 3) assert.strictEqual(wrapper.find('.breadcrumb').length, 3)
assert.equal( assert.strictEqual(
wrapper.find('.breadcrumb').at(0).props().style.backgroundColor, wrapper.find('.breadcrumb').at(0).props().style.backgroundColor,
'#FFFFFF', '#FFFFFF',
) )
assert.equal( assert.strictEqual(
wrapper.find('.breadcrumb').at(1).props().style.backgroundColor, wrapper.find('.breadcrumb').at(1).props().style.backgroundColor,
'#D8D8D8', '#D8D8D8',
) )
assert.equal( assert.strictEqual(
wrapper.find('.breadcrumb').at(2).props().style.backgroundColor, wrapper.find('.breadcrumb').at(2).props().style.backgroundColor,
'#FFFFFF', '#FFFFFF',
) )

@ -49,77 +49,80 @@ describe('ButtonGroup Component', function () {
describe('componentDidUpdate', function () { describe('componentDidUpdate', function () {
it('should set the activeButtonIndex to the updated newActiveButtonIndex', 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 }) 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 () { 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 }) wrapper.setProps({ newActiveButtonIndex: null })
assert.equal(wrapper.state('activeButtonIndex'), 1) assert.strictEqual(wrapper.state('activeButtonIndex'), 1)
}) })
}) })
describe('handleButtonClick', function () { describe('handleButtonClick', function () {
it('should set the activeButtonIndex', function () { it('should set the activeButtonIndex', function () {
assert.equal(wrapper.state('activeButtonIndex'), 1) assert.strictEqual(wrapper.state('activeButtonIndex'), 1)
wrapper.instance().handleButtonClick(2) wrapper.instance().handleButtonClick(2)
assert.equal(wrapper.state('activeButtonIndex'), 2) assert.strictEqual(wrapper.state('activeButtonIndex'), 2)
}) })
}) })
describe('renderButtons', function () { describe('renderButtons', function () {
it('should render a button for each child', function () { it('should render a button for each child', function () {
const childButtons = wrapper.find('.button-group__button') 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 () { it('should render the correct button with an active state', function () {
const childButtons = wrapper.find('.button-group__button') const childButtons = wrapper.find('.button-group__button')
const activeChildButton = wrapper.find('.button-group__button--active') 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 () { 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.strictEqual(ButtonGroup.prototype.handleButtonClick.callCount, 0)
assert.equal(childButtonSpies.onClick.callCount, 0) assert.strictEqual(childButtonSpies.onClick.callCount, 0)
const childButtons = wrapper.find('.button-group__button') const childButtons = wrapper.find('.button-group__button')
childButtons.at(0).props().onClick() childButtons.at(0).props().onClick()
childButtons.at(1).props().onClick() childButtons.at(1).props().onClick()
childButtons.at(2).props().onClick() childButtons.at(2).props().onClick()
assert.equal(ButtonGroup.prototype.handleButtonClick.callCount, 3) assert.strictEqual(ButtonGroup.prototype.handleButtonClick.callCount, 3)
assert.equal(childButtonSpies.onClick.callCount, 3) assert.strictEqual(childButtonSpies.onClick.callCount, 3)
}) })
it('should render all child buttons as disabled if props.disabled is true', function () { it('should render all child buttons as disabled if props.disabled is true', function () {
const childButtons = wrapper.find('.button-group__button') const childButtons = wrapper.find('.button-group__button')
childButtons.forEach((button) => { childButtons.forEach((button) => {
assert.equal(button.props().disabled, undefined) assert.strictEqual(button.props().disabled, undefined)
}) })
wrapper.setProps({ disabled: true }) wrapper.setProps({ disabled: true })
const disabledChildButtons = wrapper.find('[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 () { it('should render the children of the button', function () {
const mockClass = wrapper.find('.mockClass') const mockClass = wrapper.find('.mockClass')
assert.equal(mockClass.length, 1) assert.strictEqual(mockClass.length, 1)
}) })
}) })
describe('render', function () { describe('render', function () {
it('should render a div with the expected class and style', function () { it('should render a div with the expected class and style', function () {
assert.equal(wrapper.find('div').at(0).props().className, 'someClassName') assert.strictEqual(
assert.deepEqual(wrapper.find('div').at(0).props().style, { wrapper.find('div').at(0).props().className,
'someClassName',
)
assert.deepStrictEqual(wrapper.find('div').at(0).props().style, {
color: 'red', color: 'red',
}) })
}) })
it('should call renderButtons when rendering', function () { it('should call renderButtons when rendering', function () {
assert.equal(ButtonGroup.prototype.renderButtons.callCount, 1) assert.strictEqual(ButtonGroup.prototype.renderButtons.callCount, 1)
wrapper.instance().render() wrapper.instance().render()
assert.equal(ButtonGroup.prototype.renderButtons.callCount, 2) assert.strictEqual(ButtonGroup.prototype.renderButtons.callCount, 2)
}) })
}) })
}) })

@ -14,9 +14,9 @@ describe('Card Component', function () {
assert.ok(wrapper.hasClass('card-test-class')) assert.ok(wrapper.hasClass('card-test-class'))
const title = wrapper.find('.card__title') const title = wrapper.find('.card__title')
assert.ok(title) assert.ok(title)
assert.equal(title.text(), 'Test') assert.strictEqual(title.text(), 'Test')
const child = wrapper.find('.child-test-class') const child = wrapper.find('.child-test-class')
assert.ok(child) assert.ok(child)
assert.equal(child.text(), 'Child') assert.strictEqual(child.text(), 'Child')
}) })
}) })

@ -24,7 +24,7 @@ describe('CurrencyDisplay Component', function () {
) )
assert.ok(wrapper.hasClass('currency-display')) 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 () { it('should render text with a prefix', function () {
@ -38,7 +38,7 @@ describe('CurrencyDisplay Component', function () {
) )
assert.ok(wrapper.hasClass('currency-display')) assert.ok(wrapper.hasClass('currency-display'))
assert.equal(wrapper.text(), '-$123.45') assert.strictEqual(wrapper.text(), '-$123.45')
}) })
afterEach(function () { afterEach(function () {
sinon.restore() sinon.restore()

@ -15,7 +15,7 @@ describe('CurrencyInput Component', function () {
const wrapper = shallow(<CurrencyInput />) const wrapper = shallow(<CurrencyInput />)
assert.ok(wrapper) 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 () { it('should render properly with a suffix', function () {
@ -39,9 +39,9 @@ describe('CurrencyInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH')
assert.equal(wrapper.find(CurrencyDisplay).length, 1) assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1)
}) })
it('should render properly with an ETH value', function () { it('should render properly with an ETH value', function () {
@ -69,12 +69,15 @@ describe('CurrencyInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 1) assert.strictEqual(currencyInputInstance.state.decimalValue, 1)
assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') assert.strictEqual(
assert.equal(wrapper.find('.unit-input__suffix').length, 1) currencyInputInstance.state.hexValue,
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') 'de0b6b3a7640000',
assert.equal(wrapper.find('.unit-input__input').props().value, '1') )
assert.equal( 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(), wrapper.find('.currency-display-component').text(),
'$231.06USD', '$231.06USD',
) )
@ -106,12 +109,12 @@ describe('CurrencyInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 1) assert.strictEqual(currencyInputInstance.state.decimalValue, 1)
assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea')
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'USD') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'USD')
assert.equal(wrapper.find('.unit-input__input').props().value, '1') assert.strictEqual(wrapper.find('.unit-input__input').props().value, 1)
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'0.004328ETH', '0.004328ETH',
) )
@ -148,12 +151,15 @@ describe('CurrencyInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 0.004328) assert.strictEqual(currencyInputInstance.state.decimalValue, 0.004328)
assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea')
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH')
assert.equal(wrapper.find('.unit-input__input').props().value, '0.004328') assert.strictEqual(
assert.equal( wrapper.find('.unit-input__input').props().value,
0.004328,
)
assert.strictEqual(
wrapper.find('.currency-input__conversion-component').text(), wrapper.find('.currency-input__conversion-component').text(),
'noConversionRateAvailable_t', 'noConversionRateAvailable_t',
) )
@ -191,28 +197,31 @@ describe('CurrencyInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
assert.equal(handleBlurSpy.callCount, 0) assert.strictEqual(handleBlurSpy.callCount, 0)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 0) assert.strictEqual(currencyInputInstance.state.decimalValue, 0)
assert.equal(currencyInputInstance.state.hexValue, undefined) assert.strictEqual(currencyInputInstance.state.hexValue, undefined)
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$0.00USD', '$0.00USD',
) )
const input = wrapper.find('input') const input = wrapper.find('input')
assert.equal(input.props().value, 0) assert.strictEqual(input.props().value, 0)
input.simulate('change', { target: { value: 1 } }) input.simulate('change', { target: { value: 1 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000')) assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000'))
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$231.06USD', '$231.06USD',
) )
assert.equal(currencyInputInstance.state.decimalValue, 1) assert.strictEqual(currencyInputInstance.state.decimalValue, 1)
assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') assert.strictEqual(
currencyInputInstance.state.hexValue,
'de0b6b3a7640000',
)
}) })
it('should call onChange on input changes with the hex value for fiat', function () { 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.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
assert.equal(handleBlurSpy.callCount, 0) assert.strictEqual(handleBlurSpy.callCount, 0)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 0) assert.strictEqual(currencyInputInstance.state.decimalValue, 0)
assert.equal(currencyInputInstance.state.hexValue, undefined) assert.strictEqual(currencyInputInstance.state.hexValue, undefined)
assert.equal(wrapper.find('.currency-display-component').text(), '0ETH') assert.strictEqual(
wrapper.find('.currency-display-component').text(),
'0ETH',
)
const input = wrapper.find('input') const input = wrapper.find('input')
assert.equal(input.props().value, 0) assert.strictEqual(input.props().value, 0)
input.simulate('change', { target: { value: 1 } }) input.simulate('change', { target: { value: 1 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith('f602f2234d0ea')) assert.ok(handleChangeSpy.calledWith('f602f2234d0ea'))
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'0.004328ETH', '0.004328ETH',
) )
assert.equal(currencyInputInstance.state.decimalValue, 1) assert.strictEqual(currencyInputInstance.state.decimalValue, 1)
assert.equal(currencyInputInstance.state.hexValue, 'f602f2234d0ea') assert.strictEqual(currencyInputInstance.state.hexValue, 'f602f2234d0ea')
}) })
it('should change the state and pass in a new decimalValue when props.value changes', function () { 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) assert.ok(wrapper)
const currencyInputInstance = wrapper.find(CurrencyInput).dive() const currencyInputInstance = wrapper.find(CurrencyInput).dive()
assert.equal(currencyInputInstance.state('decimalValue'), 0) assert.strictEqual(currencyInputInstance.state('decimalValue'), 0)
assert.equal(currencyInputInstance.state('hexValue'), undefined) assert.strictEqual(currencyInputInstance.state('hexValue'), undefined)
assert.equal(currencyInputInstance.find(UnitInput).props().value, 0) assert.strictEqual(currencyInputInstance.find(UnitInput).props().value, 0)
currencyInputInstance.setProps({ value: '1ec05e43e72400' }) currencyInputInstance.setProps({ value: '1ec05e43e72400' })
currencyInputInstance.update() currencyInputInstance.update()
assert.equal(currencyInputInstance.state('decimalValue'), 2) assert.strictEqual(currencyInputInstance.state('decimalValue'), 2)
assert.equal(currencyInputInstance.state('hexValue'), '1ec05e43e72400') assert.strictEqual(
assert.equal(currencyInputInstance.find(UnitInput).props().value, 2) currencyInputInstance.state('hexValue'),
'1ec05e43e72400',
)
assert.strictEqual(currencyInputInstance.find(UnitInput).props().value, 2)
}) })
it('should swap selected currency when swap icon is clicked', function () { it('should swap selected currency when swap icon is clicked', function () {
@ -317,32 +332,35 @@ describe('CurrencyInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
assert.equal(handleBlurSpy.callCount, 0) assert.strictEqual(handleBlurSpy.callCount, 0)
const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance() const currencyInputInstance = wrapper.find(CurrencyInput).at(0).instance()
assert.equal(currencyInputInstance.state.decimalValue, 0) assert.strictEqual(currencyInputInstance.state.decimalValue, 0)
assert.equal(currencyInputInstance.state.hexValue, undefined) assert.strictEqual(currencyInputInstance.state.hexValue, undefined)
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$0.00USD', '$0.00USD',
) )
const input = wrapper.find('input') const input = wrapper.find('input')
assert.equal(input.props().value, 0) assert.strictEqual(input.props().value, 0)
input.simulate('change', { target: { value: 1 } }) input.simulate('change', { target: { value: 1 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000')) assert.ok(handleChangeSpy.calledWith('de0b6b3a7640000'))
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$231.06USD', '$231.06USD',
) )
assert.equal(currencyInputInstance.state.decimalValue, 1) assert.strictEqual(currencyInputInstance.state.decimalValue, 1)
assert.equal(currencyInputInstance.state.hexValue, 'de0b6b3a7640000') assert.strictEqual(
currencyInputInstance.state.hexValue,
'de0b6b3a7640000',
)
const swap = wrapper.find('.currency-input__swap-component') const swap = wrapper.find('.currency-input__swap-component')
swap.simulate('click') swap.simulate('click')
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'0.004328ETH', '0.004328ETH',
) )

@ -131,7 +131,7 @@ describe('CurrencyInput container', function () {
tests.forEach(({ mockState, expected, comment }) => { tests.forEach(({ mockState, expected, comment }) => {
it(comment, function () { it(comment, function () {
return assert.deepEqual(mapStateToProps(mockState), expected) return assert.deepStrictEqual(mapStateToProps(mockState), expected)
}) })
}) })
}) })
@ -189,7 +189,7 @@ describe('CurrencyInput container', function () {
comment, comment,
}) => { }) => {
it(comment, function () { it(comment, function () {
assert.deepEqual( assert.deepStrictEqual(
mergeProps(stateProps, dispatchProps, ownProps), mergeProps(stateProps, dispatchProps, ownProps),
expected, expected,
) )

@ -12,9 +12,9 @@ describe('ErrorMessage Component', function () {
}) })
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.error-message').length, 1) assert.strictEqual(wrapper.find('.error-message').length, 1)
assert.equal(wrapper.find('.error-message__icon').length, 1) assert.strictEqual(wrapper.find('.error-message__icon').length, 1)
assert.equal( assert.strictEqual(
wrapper.find('.error-message__text').text(), wrapper.find('.error-message__text').text(),
'ALERT: This is an error.', 'ALERT: This is an error.',
) )
@ -26,9 +26,9 @@ describe('ErrorMessage Component', function () {
}) })
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.error-message').length, 1) assert.strictEqual(wrapper.find('.error-message').length, 1)
assert.equal(wrapper.find('.error-message__icon').length, 1) assert.strictEqual(wrapper.find('.error-message__icon').length, 1)
assert.equal( assert.strictEqual(
wrapper.find('.error-message__text').text(), wrapper.find('.error-message__text').text(),
'ALERT: translate testKey', 'ALERT: translate testKey',
) )

@ -10,7 +10,7 @@ describe('HexToDecimal Component', function () {
) )
assert.ok(wrapper.hasClass('hex-to-decimal')) 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 () { 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.ok(wrapper.hasClass('hex-to-decimal'))
assert.equal(wrapper.text(), '6789') assert.strictEqual(wrapper.text(), '6789')
}) })
}) })

@ -19,7 +19,7 @@ describe('Identicon', function () {
it('renders default eth_logo identicon with no props', function () { it('renders default eth_logo identicon with no props', function () {
const wrapper = mount(<Identicon store={store} />) const wrapper = mount(<Identicon store={store} />)
assert.equal( assert.strictEqual(
wrapper.find('img.identicon__eth-logo').prop('src'), wrapper.find('img.identicon__eth-logo').prop('src'),
'./images/eth_logo.svg', './images/eth_logo.svg',
) )
@ -30,11 +30,11 @@ describe('Identicon', function () {
<Identicon store={store} className="test-image" image="test-image" />, <Identicon store={store} className="test-image" image="test-image" />,
) )
assert.equal( assert.strictEqual(
wrapper.find('img.test-image').prop('className'), wrapper.find('img.test-image').prop('className'),
'identicon test-image', '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 () { it('renders div with address prop', function () {
@ -42,7 +42,7 @@ describe('Identicon', function () {
<Identicon store={store} className="test-address" address="0xTest" />, <Identicon store={store} className="test-address" address="0xTest" />,
) )
assert.equal( assert.strictEqual(
wrapper.find('div.test-address').prop('className'), wrapper.find('div.test-address').prop('className'),
'identicon test-address', 'identicon test-address',
) )

@ -35,13 +35,13 @@ describe('ListItem', function () {
) )
}) })
it('includes the data-testid', 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 () { 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 () { it(`renders "I am a list item" subtitle`, function () {
assert.equal( assert.strictEqual(
wrapper.find('.list-item__subheading').text(), wrapper.find('.list-item__subheading').text(),
'I am a list item', 'I am a list item',
) )
@ -50,19 +50,19 @@ describe('ListItem', function () {
assert(wrapper.props().className.includes(CLASSNAME)) assert(wrapper.props().className.includes(CLASSNAME))
}) })
it('renders content on the right side of the list item', function () { it('renders content on the right side of the list item', function () {
assert.equal( assert.strictEqual(
wrapper.find('.list-item__right-content p').text(), wrapper.find('.list-item__right-content p').text(),
'Content rendered to the right', 'Content rendered to the right',
) )
}) })
it('renders content in the middle of the list item', function () { it('renders content in the middle of the list item', function () {
assert.equal( assert.strictEqual(
wrapper.find('.list-item__mid-content p').text(), wrapper.find('.list-item__mid-content p').text(),
'Content rendered in the middle', 'Content rendered in the middle',
) )
}) })
it('renders list item actions', function () { it('renders list item actions', function () {
assert.equal( assert.strictEqual(
wrapper.find('.list-item__actions button').text(), wrapper.find('.list-item__actions button').text(),
'I am a button', 'I am a button',
) )
@ -75,7 +75,7 @@ describe('ListItem', function () {
}) })
it('handles click action and fires onClick', function () { it('handles click action and fires onClick', function () {
wrapper.simulate('click') wrapper.simulate('click')
assert.equal(clickHandler.callCount, 1) assert.strictEqual(clickHandler.callCount, 1)
}) })
after(function () { after(function () {

@ -7,11 +7,11 @@ describe('MetaFoxLogo', function () {
it('sets icon height and width to 42 by default', function () { it('sets icon height and width to 42 by default', function () {
const wrapper = mount(<MetaFoxLogo />) const wrapper = mount(<MetaFoxLogo />)
assert.equal( assert.strictEqual(
wrapper.find('img.app-header__metafox-logo--icon').prop('width'), wrapper.find('img.app-header__metafox-logo--icon').prop('width'),
42, 42,
) )
assert.equal( assert.strictEqual(
wrapper.find('img.app-header__metafox-logo--icon').prop('height'), wrapper.find('img.app-header__metafox-logo--icon').prop('height'),
42, 42,
) )
@ -20,13 +20,13 @@ describe('MetaFoxLogo', function () {
it('does not set icon height and width when unsetIconHeight is true', function () { it('does not set icon height and width when unsetIconHeight is true', function () {
const wrapper = mount(<MetaFoxLogo unsetIconHeight />) const wrapper = mount(<MetaFoxLogo unsetIconHeight />)
assert.equal( assert.strictEqual(
wrapper.find('img.app-header__metafox-logo--icon').prop('width'), 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'), wrapper.find('img.app-header__metafox-logo--icon').prop('height'),
null, undefined,
) )
}) })
}) })

@ -24,7 +24,7 @@ describe('Page Footer', function () {
}) })
it('renders page container 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 () { 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}]`) } }, { 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 () { it('renders two button components', function () {
assert.equal(wrapper.find(Button).length, 2) assert.strictEqual(wrapper.find(Button).length, 2)
}) })
describe('Cancel Button', function () { describe('Cancel Button', function () {
it('has button type of default', function () { it('has button type of default', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__footer-button').first().prop('type'), wrapper.find('.page-container__footer-button').first().prop('type'),
'default', 'default',
) )
}) })
it('has children text of Cancel', function () { it('has children text of Cancel', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__footer-button').first().prop('children'), wrapper.find('.page-container__footer-button').first().prop('children'),
'Cancel', 'Cancel',
) )
@ -59,27 +62,27 @@ describe('Page Footer', function () {
it('should call cancel when click is simulated', function () { it('should call cancel when click is simulated', function () {
wrapper.find('.page-container__footer-button').first().prop('onClick')() wrapper.find('.page-container__footer-button').first().prop('onClick')()
assert.equal(onCancel.callCount, 1) assert.strictEqual(onCancel.callCount, 1)
}) })
}) })
describe('Submit Button', function () { describe('Submit Button', function () {
it('assigns button type based on props', function () { it('assigns button type based on props', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__footer-button').last().prop('type'), wrapper.find('.page-container__footer-button').last().prop('type'),
'Test Type', 'Test Type',
) )
}) })
it('has disabled prop', function () { it('has disabled prop', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__footer-button').last().prop('disabled'), wrapper.find('.page-container__footer-button').last().prop('disabled'),
false, false,
) )
}) })
it('has children text when submitText prop exists', function () { it('has children text when submitText prop exists', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__footer-button').last().prop('children'), wrapper.find('.page-container__footer-button').last().prop('children'),
'Submit', 'Submit',
) )
@ -87,7 +90,7 @@ describe('Page Footer', function () {
it('should call submit when click is simulated', function () { it('should call submit when click is simulated', function () {
wrapper.find('.page-container__footer-button').last().prop('onClick')() wrapper.find('.page-container__footer-button').last().prop('onClick')()
assert.equal(onSubmit.callCount, 1) assert.strictEqual(onSubmit.callCount, 1)
}) })
}) })
}) })

@ -27,12 +27,15 @@ describe('Page Container Header', function () {
describe('Render Header Row', function () { describe('Render Header Row', function () {
it('renders back button', function () { it('renders back button', function () {
assert.equal(wrapper.find('.page-container__back-button').length, 1) assert.strictEqual(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').text(),
'Back',
)
}) })
it('ensures style prop', function () { it('ensures style prop', function () {
assert.equal( assert.strictEqual(
wrapper.find('.page-container__back-button').props().style, wrapper.find('.page-container__back-button').props().style,
style, style,
) )
@ -40,7 +43,7 @@ describe('Page Container Header', function () {
it('should call back button when click is simulated', function () { it('should call back button when click is simulated', function () {
wrapper.find('.page-container__back-button').prop('onClick')() 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 () { it('renders page container', function () {
assert.equal(header.length, 1) assert.strictEqual(header.length, 1)
assert.equal(headerRow.length, 1) assert.strictEqual(headerRow.length, 1)
assert.equal(pageTitle.length, 1) assert.strictEqual(pageTitle.length, 1)
assert.equal(pageSubtitle.length, 1) assert.strictEqual(pageSubtitle.length, 1)
assert.equal(pageClose.length, 1) assert.strictEqual(pageClose.length, 1)
assert.equal(pageTab.length, 1) assert.strictEqual(pageTab.length, 1)
}) })
it('renders title', function () { it('renders title', function () {
assert.equal(pageTitle.text(), 'Test Title') assert.strictEqual(pageTitle.text(), 'Test Title')
}) })
it('renders subtitle', function () { it('renders subtitle', function () {
assert.equal(pageSubtitle.text(), 'Test Subtitle') assert.strictEqual(pageSubtitle.text(), 'Test Subtitle')
}) })
it('renders tabs', function () { 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 () { it('should call close when click is simulated', function () {
pageClose.prop('onClick')() pageClose.prop('onClick')()
assert.equal(onClose.callCount, 1) assert.strictEqual(onClose.callCount, 1)
}) })
}) })
}) })

@ -41,13 +41,13 @@ describe('TokenInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC')
assert.equal( assert.strictEqual(
wrapper.find('.currency-input__conversion-component').length, wrapper.find('.currency-input__conversion-component').length,
1, 1,
) )
assert.equal( assert.strictEqual(
wrapper.find('.currency-input__conversion-component').text(), wrapper.find('.currency-input__conversion-component').text(),
'translate noConversionRateAvailable', 'translate noConversionRateAvailable',
) )
@ -82,9 +82,9 @@ describe('TokenInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC')
assert.equal(wrapper.find(CurrencyDisplay).length, 1) assert.strictEqual(wrapper.find(CurrencyDisplay).length, 1)
}) })
it('should render properly with a token value for ETH', function () { it('should render properly with a token value for ETH', function () {
@ -112,12 +112,15 @@ describe('TokenInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() const tokenInputInstance = wrapper.find(TokenInput).at(0).instance()
assert.equal(tokenInputInstance.state.decimalValue, 1) assert.strictEqual(tokenInputInstance.state.decimalValue, '1')
assert.equal(tokenInputInstance.state.hexValue, '2710') assert.strictEqual(tokenInputInstance.state.hexValue, '2710')
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC')
assert.equal(wrapper.find('.unit-input__input').props().value, '1') assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1')
assert.equal(wrapper.find('.currency-display-component').text(), '2ETH') assert.strictEqual(
wrapper.find('.currency-display-component').text(),
'2ETH',
)
}) })
it('should render properly with a token value for fiat', function () { it('should render properly with a token value for fiat', function () {
@ -146,12 +149,12 @@ describe('TokenInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() const tokenInputInstance = wrapper.find(TokenInput).at(0).instance()
assert.equal(tokenInputInstance.state.decimalValue, 1) assert.strictEqual(tokenInputInstance.state.decimalValue, '1')
assert.equal(tokenInputInstance.state.hexValue, '2710') assert.strictEqual(tokenInputInstance.state.hexValue, '2710')
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC')
assert.equal(wrapper.find('.unit-input__input').props().value, '1') assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1')
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$462.12USD', '$462.12USD',
) )
@ -190,12 +193,12 @@ describe('TokenInput Component', function () {
assert.ok(wrapper) assert.ok(wrapper)
const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() const tokenInputInstance = wrapper.find(TokenInput).at(0).instance()
assert.equal(tokenInputInstance.state.decimalValue, 1) assert.strictEqual(tokenInputInstance.state.decimalValue, '1')
assert.equal(tokenInputInstance.state.hexValue, '2710') assert.strictEqual(tokenInputInstance.state.hexValue, '2710')
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ABC') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ABC')
assert.equal(wrapper.find('.unit-input__input').props().value, '1') assert.strictEqual(wrapper.find('.unit-input__input').props().value, '1')
assert.equal( assert.strictEqual(
wrapper.find('.currency-input__conversion-component').text(), wrapper.find('.currency-input__conversion-component').text(),
'translate noConversionRateAvailable', 'translate noConversionRateAvailable',
) )
@ -234,22 +237,28 @@ describe('TokenInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
assert.equal(handleBlurSpy.callCount, 0) assert.strictEqual(handleBlurSpy.callCount, 0)
const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() const tokenInputInstance = wrapper.find(TokenInput).at(0).instance()
assert.equal(tokenInputInstance.state.decimalValue, 0) assert.strictEqual(tokenInputInstance.state.decimalValue, 0)
assert.equal(tokenInputInstance.state.hexValue, undefined) assert.strictEqual(tokenInputInstance.state.hexValue, undefined)
assert.equal(wrapper.find('.currency-display-component').text(), '0ETH') assert.strictEqual(
wrapper.find('.currency-display-component').text(),
'0ETH',
)
const input = wrapper.find('input') const input = wrapper.find('input')
assert.equal(input.props().value, 0) assert.strictEqual(input.props().value, 0)
input.simulate('change', { target: { value: 1 } }) input.simulate('change', { target: { value: 1 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith('2710')) assert.ok(handleChangeSpy.calledWith('2710'))
assert.equal(wrapper.find('.currency-display-component').text(), '2ETH') assert.strictEqual(
assert.equal(tokenInputInstance.state.decimalValue, 1) wrapper.find('.currency-display-component').text(),
assert.equal(tokenInputInstance.state.hexValue, '2710') '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 () { 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.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
assert.equal(handleBlurSpy.callCount, 0) assert.strictEqual(handleBlurSpy.callCount, 0)
const tokenInputInstance = wrapper.find(TokenInput).at(0).instance() const tokenInputInstance = wrapper.find(TokenInput).at(0).instance()
assert.equal(tokenInputInstance.state.decimalValue, 0) assert.strictEqual(tokenInputInstance.state.decimalValue, 0)
assert.equal(tokenInputInstance.state.hexValue, undefined) assert.strictEqual(tokenInputInstance.state.hexValue, undefined)
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$0.00USD', '$0.00USD',
) )
const input = wrapper.find('input') const input = wrapper.find('input')
assert.equal(input.props().value, 0) assert.strictEqual(input.props().value, 0)
input.simulate('change', { target: { value: 1 } }) input.simulate('change', { target: { value: 1 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith('2710')) assert.ok(handleChangeSpy.calledWith('2710'))
assert.equal( assert.strictEqual(
wrapper.find('.currency-display-component').text(), wrapper.find('.currency-display-component').text(),
'$462.12USD', '$462.12USD',
) )
assert.equal(tokenInputInstance.state.decimalValue, 1) assert.strictEqual(tokenInputInstance.state.decimalValue, 1)
assert.equal(tokenInputInstance.state.hexValue, '2710') assert.strictEqual(tokenInputInstance.state.hexValue, '2710')
}) })
it('should change the state and pass in a new decimalValue when props.value changes', function () { 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) assert.ok(wrapper)
const tokenInputInstance = wrapper.find(TokenInput).dive() const tokenInputInstance = wrapper.find(TokenInput).dive()
assert.equal(tokenInputInstance.state('decimalValue'), 0) assert.strictEqual(tokenInputInstance.state('decimalValue'), 0)
assert.equal(tokenInputInstance.state('hexValue'), undefined) assert.strictEqual(tokenInputInstance.state('hexValue'), undefined)
assert.equal(tokenInputInstance.find(UnitInput).props().value, 0) assert.strictEqual(tokenInputInstance.find(UnitInput).props().value, 0)
tokenInputInstance.setProps({ value: '2710' }) tokenInputInstance.setProps({ value: '2710' })
tokenInputInstance.update() tokenInputInstance.update()
assert.equal(tokenInputInstance.state('decimalValue'), 1) assert.strictEqual(tokenInputInstance.state('decimalValue'), '1')
assert.equal(tokenInputInstance.state('hexValue'), '2710') assert.strictEqual(tokenInputInstance.state('hexValue'), '2710')
assert.equal(tokenInputInstance.find(UnitInput).props().value, 1) assert.strictEqual(tokenInputInstance.find(UnitInput).props().value, '1')
}) })
}) })
}) })

@ -10,15 +10,15 @@ describe('UnitInput Component', function () {
const wrapper = shallow(<UnitInput />) const wrapper = shallow(<UnitInput />)
assert.ok(wrapper) 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 () { it('should render properly with a suffix', function () {
const wrapper = shallow(<UnitInput suffix="ETH" />) const wrapper = shallow(<UnitInput suffix="ETH" />)
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.unit-input__suffix').length, 1) assert.strictEqual(wrapper.find('.unit-input__suffix').length, 1)
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH') assert.strictEqual(wrapper.find('.unit-input__suffix').text(), 'ETH')
}) })
it('should render properly with a child component', function () { it('should render properly with a child component', function () {
@ -29,15 +29,15 @@ describe('UnitInput Component', function () {
) )
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(wrapper.find('.testing').length, 1) assert.strictEqual(wrapper.find('.testing').length, 1)
assert.equal(wrapper.find('.testing').text(), 'TESTCOMPONENT') assert.strictEqual(wrapper.find('.testing').text(), 'TESTCOMPONENT')
}) })
it('should render with an error class when props.error === true', function () { it('should render with an error class when props.error === true', function () {
const wrapper = shallow(<UnitInput error />) const wrapper = shallow(<UnitInput error />)
assert.ok(wrapper) 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') const handleFocusSpy = sinon.spy(wrapper.instance(), 'handleFocus')
wrapper.instance().forceUpdate() wrapper.instance().forceUpdate()
wrapper.update() wrapper.update()
assert.equal(handleFocusSpy.callCount, 0) assert.strictEqual(handleFocusSpy.callCount, 0)
wrapper.find('.unit-input').simulate('click') 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 () { it('should call onChange on input changes with the value', function () {
const wrapper = mount(<UnitInput onChange={handleChangeSpy} />) const wrapper = mount(<UnitInput onChange={handleChangeSpy} />)
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
const input = wrapper.find('input') const input = wrapper.find('input')
input.simulate('change', { target: { value: 123 } }) input.simulate('change', { target: { value: 123 } })
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith(123)) 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 () { it('should set the component state value with props.value', function () {
const wrapper = mount(<UnitInput value={123} />) const wrapper = mount(<UnitInput value={123} />)
assert.ok(wrapper) 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 () { it('should update the component state value with props.value', function () {
const wrapper = mount(<UnitInput onChange={handleChangeSpy} />) const wrapper = mount(<UnitInput onChange={handleChangeSpy} />)
assert.ok(wrapper) assert.ok(wrapper)
assert.equal(handleChangeSpy.callCount, 0) assert.strictEqual(handleChangeSpy.callCount, 0)
const input = wrapper.find('input') const input = wrapper.find('input')
input.simulate('change', { target: { value: 123 } }) input.simulate('change', { target: { value: 123 } })
assert.equal(wrapper.state('value'), 123) assert.strictEqual(wrapper.state('value'), 123)
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
assert.ok(handleChangeSpy.calledWith(123)) assert.ok(handleChangeSpy.calledWith(123))
wrapper.setProps({ value: 456 }) wrapper.setProps({ value: 456 })
assert.equal(wrapper.state('value'), 456) assert.strictEqual(wrapper.state('value'), 456)
assert.equal(handleChangeSpy.callCount, 1) assert.strictEqual(handleChangeSpy.callCount, 1)
}) })
}) })
}) })

@ -83,11 +83,14 @@ describe('Confirm Transaction Duck', function () {
} }
it('should initialize state', 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 () { it('should return state unchanged if it does not match a dispatched actions type', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: 'someOtherAction', type: 'someOtherAction',
value: 'someValue', value: 'someValue',
@ -97,7 +100,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should set txData when receiving a UPDATE_TX_DATA action', function () { it('should set txData when receiving a UPDATE_TX_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TX_DATA, type: UPDATE_TX_DATA,
payload: { payload: {
@ -115,7 +118,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should clear txData when receiving a CLEAR_TX_DATA action', function () { it('should clear txData when receiving a CLEAR_TX_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: CLEAR_TX_DATA, 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 () { it('should set tokenData when receiving a UPDATE_TOKEN_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TOKEN_DATA, type: UPDATE_TOKEN_DATA,
payload: { payload: {
@ -145,7 +148,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should clear tokenData when receiving a CLEAR_TOKEN_DATA action', function () { it('should clear tokenData when receiving a CLEAR_TOKEN_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: CLEAR_TOKEN_DATA, 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 () { it('should set methodData when receiving a UPDATE_METHOD_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_METHOD_DATA, type: UPDATE_METHOD_DATA,
payload: { payload: {
@ -175,7 +178,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should clear methodData when receiving a CLEAR_METHOD_DATA action', function () { it('should clear methodData when receiving a CLEAR_METHOD_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: CLEAR_METHOD_DATA, 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 () { it('should update transaction amounts when receiving an UPDATE_TRANSACTION_AMOUNTS action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TRANSACTION_AMOUNTS, type: UPDATE_TRANSACTION_AMOUNTS,
payload: { payload: {
@ -206,7 +209,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should update transaction fees when receiving an UPDATE_TRANSACTION_FEES action', function () { it('should update transaction fees when receiving an UPDATE_TRANSACTION_FEES action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TRANSACTION_FEES, type: UPDATE_TRANSACTION_FEES,
payload: { payload: {
@ -225,7 +228,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should update transaction totals when receiving an UPDATE_TRANSACTION_TOTALS action', function () { it('should update transaction totals when receiving an UPDATE_TRANSACTION_TOTALS action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TRANSACTION_TOTALS, type: UPDATE_TRANSACTION_TOTALS,
payload: { payload: {
@ -244,7 +247,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should update tokenProps when receiving an UPDATE_TOKEN_PROPS action', function () { it('should update tokenProps when receiving an UPDATE_TOKEN_PROPS action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TOKEN_PROPS, type: UPDATE_TOKEN_PROPS,
payload: { payload: {
@ -263,7 +266,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should update nonce when receiving an UPDATE_NONCE action', function () { it('should update nonce when receiving an UPDATE_NONCE action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_NONCE, type: UPDATE_NONCE,
payload: '0x1', payload: '0x1',
@ -276,7 +279,7 @@ describe('Confirm Transaction Duck', function () {
}) })
it('should update nonce when receiving an UPDATE_TO_SMART_CONTRACT action', function () { it('should update nonce when receiving an UPDATE_TO_SMART_CONTRACT action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: UPDATE_TO_SMART_CONTRACT, type: UPDATE_TO_SMART_CONTRACT,
payload: true, 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 () { it('should set fetchingData to true when receiving a FETCH_DATA_START action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: FETCH_DATA_START, 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 () { it('should set fetchingData to false when receiving a FETCH_DATA_END action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer( ConfirmTransactionReducer(
{ fetchingData: true }, { fetchingData: true },
{ type: FETCH_DATA_END }, { 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 () { it('should clear confirmTransaction when receiving a FETCH_DATA_END action', function () {
assert.deepEqual( assert.deepStrictEqual(
ConfirmTransactionReducer(mockState, { ConfirmTransactionReducer(mockState, {
type: CLEAR_CONFIRM_TRANSACTION, type: CLEAR_CONFIRM_TRANSACTION,
}), }),
@ -328,7 +331,7 @@ describe('Confirm Transaction Duck', function () {
payload: txData, payload: txData,
} }
assert.deepEqual(actions.updateTxData(txData), expectedAction) assert.deepStrictEqual(actions.updateTxData(txData), expectedAction)
}) })
it('should create an action to clear txData', function () { it('should create an action to clear txData', function () {
@ -336,7 +339,7 @@ describe('Confirm Transaction Duck', function () {
type: CLEAR_TX_DATA, type: CLEAR_TX_DATA,
} }
assert.deepEqual(actions.clearTxData(), expectedAction) assert.deepStrictEqual(actions.clearTxData(), expectedAction)
}) })
it('should create an action to update tokenData', function () { it('should create an action to update tokenData', function () {
@ -346,7 +349,7 @@ describe('Confirm Transaction Duck', function () {
payload: tokenData, payload: tokenData,
} }
assert.deepEqual(actions.updateTokenData(tokenData), expectedAction) assert.deepStrictEqual(actions.updateTokenData(tokenData), expectedAction)
}) })
it('should create an action to clear tokenData', function () { it('should create an action to clear tokenData', function () {
@ -354,7 +357,7 @@ describe('Confirm Transaction Duck', function () {
type: CLEAR_TOKEN_DATA, type: CLEAR_TOKEN_DATA,
} }
assert.deepEqual(actions.clearTokenData(), expectedAction) assert.deepStrictEqual(actions.clearTokenData(), expectedAction)
}) })
it('should create an action to update methodData', function () { it('should create an action to update methodData', function () {
@ -364,7 +367,10 @@ describe('Confirm Transaction Duck', function () {
payload: methodData, payload: methodData,
} }
assert.deepEqual(actions.updateMethodData(methodData), expectedAction) assert.deepStrictEqual(
actions.updateMethodData(methodData),
expectedAction,
)
}) })
it('should create an action to clear methodData', function () { it('should create an action to clear methodData', function () {
@ -372,7 +378,7 @@ describe('Confirm Transaction Duck', function () {
type: CLEAR_METHOD_DATA, type: CLEAR_METHOD_DATA,
} }
assert.deepEqual(actions.clearMethodData(), expectedAction) assert.deepStrictEqual(actions.clearMethodData(), expectedAction)
}) })
it('should create an action to update transaction amounts', function () { it('should create an action to update transaction amounts', function () {
@ -382,7 +388,7 @@ describe('Confirm Transaction Duck', function () {
payload: transactionAmounts, payload: transactionAmounts,
} }
assert.deepEqual( assert.deepStrictEqual(
actions.updateTransactionAmounts(transactionAmounts), actions.updateTransactionAmounts(transactionAmounts),
expectedAction, expectedAction,
) )
@ -395,7 +401,7 @@ describe('Confirm Transaction Duck', function () {
payload: transactionFees, payload: transactionFees,
} }
assert.deepEqual( assert.deepStrictEqual(
actions.updateTransactionFees(transactionFees), actions.updateTransactionFees(transactionFees),
expectedAction, expectedAction,
) )
@ -408,7 +414,7 @@ describe('Confirm Transaction Duck', function () {
payload: transactionTotals, payload: transactionTotals,
} }
assert.deepEqual( assert.deepStrictEqual(
actions.updateTransactionTotals(transactionTotals), actions.updateTransactionTotals(transactionTotals),
expectedAction, expectedAction,
) )
@ -424,7 +430,10 @@ describe('Confirm Transaction Duck', function () {
payload: tokenProps, payload: tokenProps,
} }
assert.deepEqual(actions.updateTokenProps(tokenProps), expectedAction) assert.deepStrictEqual(
actions.updateTokenProps(tokenProps),
expectedAction,
)
}) })
it('should create an action to update nonce', function () { it('should create an action to update nonce', function () {
@ -434,7 +443,7 @@ describe('Confirm Transaction Duck', function () {
payload: nonce, 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 () { it('should create an action to set fetchingData to true', function () {
@ -442,7 +451,7 @@ describe('Confirm Transaction Duck', function () {
type: FETCH_DATA_START, 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 () { it('should create an action to set fetchingData to false', function () {
@ -450,7 +459,7 @@ describe('Confirm Transaction Duck', function () {
type: FETCH_DATA_END, 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 () { it('should create an action to clear confirmTransaction', function () {
@ -458,7 +467,7 @@ describe('Confirm Transaction Duck', function () {
type: CLEAR_CONFIRM_TRANSACTION, 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() const storeActions = store.getActions()
assert.equal(storeActions.length, expectedActions.length) assert.strictEqual(storeActions.length, expectedActions.length)
storeActions.forEach((action, index) => 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)) store.dispatch(actions.updateTxDataAndCalculate(txData))
const storeActions = store.getActions() const storeActions = store.getActions()
assert.equal(storeActions.length, expectedActions.length) assert.strictEqual(storeActions.length, expectedActions.length)
storeActions.forEach((action, index) => 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)) store.dispatch(actions.setTransactionToConfirm(2603411941761054))
const storeActions = store.getActions() const storeActions = store.getActions()
assert.equal(storeActions.length, expectedActions.length) assert.strictEqual(storeActions.length, expectedActions.length)
storeActions.forEach((action, index) => storeActions.forEach((action, index) =>
assert.equal(action.type, expectedActions[index]), assert.strictEqual(action.type, expectedActions[index]),
) )
}) })
}) })

@ -86,11 +86,11 @@ describe('Gas Duck', function () {
describe('GasReducer()', function () { describe('GasReducer()', function () {
it('should initialize state', 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 () { it('should return state unchanged if it does not match a dispatched actions type', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: 'someOtherAction', type: 'someOtherAction',
value: 'someValue', 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 () { 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 }), GasReducer(mockState, { type: BASIC_GAS_ESTIMATE_LOADING_STARTED }),
{ basicEstimateIsLoading: true, ...mockState }, { basicEstimateIsLoading: true, ...mockState },
) )
}) })
it('should set basicEstimateIsLoading to false when receiving a BASIC_GAS_ESTIMATE_LOADING_FINISHED action', function () { 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 }), GasReducer(mockState, { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }),
{ basicEstimateIsLoading: false, ...mockState }, { basicEstimateIsLoading: false, ...mockState },
) )
}) })
it('should set basicEstimates when receiving a SET_BASIC_GAS_ESTIMATE_DATA action', function () { it('should set basicEstimates when receiving a SET_BASIC_GAS_ESTIMATE_DATA action', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: SET_BASIC_GAS_ESTIMATE_DATA, type: SET_BASIC_GAS_ESTIMATE_DATA,
value: { someProp: 'someData123' }, 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 () { it('should set customData.price when receiving a SET_CUSTOM_GAS_PRICE action', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: SET_CUSTOM_GAS_PRICE, type: SET_CUSTOM_GAS_PRICE,
value: 4321, value: 4321,
@ -134,7 +134,7 @@ describe('Gas Duck', function () {
}) })
it('should set customData.limit when receiving a SET_CUSTOM_GAS_LIMIT action', function () { it('should set customData.limit when receiving a SET_CUSTOM_GAS_LIMIT action', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: SET_CUSTOM_GAS_LIMIT, type: SET_CUSTOM_GAS_LIMIT,
value: 9876, value: 9876,
@ -144,7 +144,7 @@ describe('Gas Duck', function () {
}) })
it('should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action', function () { it('should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: SET_CUSTOM_GAS_TOTAL, type: SET_CUSTOM_GAS_TOTAL,
value: 10000, value: 10000,
@ -154,7 +154,7 @@ describe('Gas Duck', function () {
}) })
it('should set errors when receiving a SET_CUSTOM_GAS_ERRORS action', function () { it('should set errors when receiving a SET_CUSTOM_GAS_ERRORS action', function () {
assert.deepEqual( assert.deepStrictEqual(
GasReducer(mockState, { GasReducer(mockState, {
type: SET_CUSTOM_GAS_ERRORS, type: SET_CUSTOM_GAS_ERRORS,
value: { someError: 'error_error' }, 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 () { 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 }), GasReducer(mockState, { type: RESET_CUSTOM_GAS_STATE }),
initState, initState,
) )
@ -173,7 +173,7 @@ describe('Gas Duck', function () {
describe('basicGasEstimatesLoadingStarted', function () { describe('basicGasEstimatesLoadingStarted', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(basicGasEstimatesLoadingStarted(), { assert.deepStrictEqual(basicGasEstimatesLoadingStarted(), {
type: BASIC_GAS_ESTIMATE_LOADING_STARTED, type: BASIC_GAS_ESTIMATE_LOADING_STARTED,
}) })
}) })
@ -181,7 +181,7 @@ describe('Gas Duck', function () {
describe('basicGasEstimatesLoadingFinished', function () { describe('basicGasEstimatesLoadingFinished', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(basicGasEstimatesLoadingFinished(), { assert.deepStrictEqual(basicGasEstimatesLoadingFinished(), {
type: BASIC_GAS_ESTIMATE_LOADING_FINISHED, type: BASIC_GAS_ESTIMATE_LOADING_FINISHED,
}) })
}) })
@ -194,7 +194,7 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates()(mockDistpatch, () => ({ await fetchBasicGasEstimates()(mockDistpatch, () => ({
gas: { ...initState, basicPriceAEstimatesLastRetrieved: 1000000 }, gas: { ...initState, basicPriceAEstimatesLastRetrieved: 1000000 },
})) }))
assert.deepEqual(mockDistpatch.getCall(0).args, [ assert.deepStrictEqual(mockDistpatch.getCall(0).args, [
{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, { type: BASIC_GAS_ESTIMATE_LOADING_STARTED },
]) ])
assert.ok( assert.ok(
@ -203,10 +203,10 @@ describe('Gas Duck', function () {
.args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'), .args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'),
'should fetch metaswap /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 }, { 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, type: SET_BASIC_GAS_ESTIMATE_DATA,
value: { 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 }, { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED },
]) ])
}) })
@ -235,11 +235,11 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates()(mockDistpatch, () => ({ await fetchBasicGasEstimates()(mockDistpatch, () => ({
gas: { ...initState }, gas: { ...initState },
})) }))
assert.deepEqual(mockDistpatch.getCall(0).args, [ assert.deepStrictEqual(mockDistpatch.getCall(0).args, [
{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, { type: BASIC_GAS_ESTIMATE_LOADING_STARTED },
]) ])
assert.ok(window.fetch.notCalled) assert.ok(window.fetch.notCalled)
assert.deepEqual(mockDistpatch.getCall(1).args, [ assert.deepStrictEqual(mockDistpatch.getCall(1).args, [
{ {
type: SET_BASIC_GAS_ESTIMATE_DATA, type: SET_BASIC_GAS_ESTIMATE_DATA,
value: { 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 }, { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED },
]) ])
}) })
@ -263,7 +263,7 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates()(mockDistpatch, () => ({ await fetchBasicGasEstimates()(mockDistpatch, () => ({
gas: { ...initState }, gas: { ...initState },
})) }))
assert.deepEqual(mockDistpatch.getCall(0).args, [ assert.deepStrictEqual(mockDistpatch.getCall(0).args, [
{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED }, { type: BASIC_GAS_ESTIMATE_LOADING_STARTED },
]) ])
assert.ok( assert.ok(
@ -272,10 +272,10 @@ describe('Gas Duck', function () {
.args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'), .args[0].startsWith('https://api.metaswap.codefi.network/gasPrices'),
'should fetch metaswap /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 }, { 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, type: SET_BASIC_GAS_ESTIMATE_DATA,
value: { 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 }, { type: BASIC_GAS_ESTIMATE_LOADING_FINISHED },
]) ])
}) })
@ -293,7 +293,7 @@ describe('Gas Duck', function () {
describe('setBasicGasEstimateData', function () { describe('setBasicGasEstimateData', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(setBasicGasEstimateData('mockBasicEstimatData'), { assert.deepStrictEqual(setBasicGasEstimateData('mockBasicEstimatData'), {
type: SET_BASIC_GAS_ESTIMATE_DATA, type: SET_BASIC_GAS_ESTIMATE_DATA,
value: 'mockBasicEstimatData', value: 'mockBasicEstimatData',
}) })
@ -302,7 +302,7 @@ describe('Gas Duck', function () {
describe('setCustomGasPrice', function () { describe('setCustomGasPrice', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(setCustomGasPrice('mockCustomGasPrice'), { assert.deepStrictEqual(setCustomGasPrice('mockCustomGasPrice'), {
type: SET_CUSTOM_GAS_PRICE, type: SET_CUSTOM_GAS_PRICE,
value: 'mockCustomGasPrice', value: 'mockCustomGasPrice',
}) })
@ -311,7 +311,7 @@ describe('Gas Duck', function () {
describe('setCustomGasLimit', function () { describe('setCustomGasLimit', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(setCustomGasLimit('mockCustomGasLimit'), { assert.deepStrictEqual(setCustomGasLimit('mockCustomGasLimit'), {
type: SET_CUSTOM_GAS_LIMIT, type: SET_CUSTOM_GAS_LIMIT,
value: 'mockCustomGasLimit', value: 'mockCustomGasLimit',
}) })
@ -320,7 +320,7 @@ describe('Gas Duck', function () {
describe('setCustomGasTotal', function () { describe('setCustomGasTotal', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(setCustomGasTotal('mockCustomGasTotal'), { assert.deepStrictEqual(setCustomGasTotal('mockCustomGasTotal'), {
type: SET_CUSTOM_GAS_TOTAL, type: SET_CUSTOM_GAS_TOTAL,
value: 'mockCustomGasTotal', value: 'mockCustomGasTotal',
}) })
@ -329,7 +329,7 @@ describe('Gas Duck', function () {
describe('setCustomGasErrors', function () { describe('setCustomGasErrors', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(setCustomGasErrors('mockErrorObject'), { assert.deepStrictEqual(setCustomGasErrors('mockErrorObject'), {
type: SET_CUSTOM_GAS_ERRORS, type: SET_CUSTOM_GAS_ERRORS,
value: 'mockErrorObject', value: 'mockErrorObject',
}) })
@ -338,7 +338,9 @@ describe('Gas Duck', function () {
describe('resetCustomGasState', function () { describe('resetCustomGasState', function () {
it('should create the correct action', function () { it('should create the correct action', function () {
assert.deepEqual(resetCustomGasState(), { type: RESET_CUSTOM_GAS_STATE }) assert.deepStrictEqual(resetCustomGasState(), {
type: RESET_CUSTOM_GAS_STATE,
})
}) })
}) })
}) })

@ -26,11 +26,11 @@ describe('Send Duck', function () {
describe('SendReducer()', function () { describe('SendReducer()', function () {
it('should initialize state', 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 () { it('should return state unchanged if it does not match a dispatched actions type', function () {
assert.deepEqual( assert.deepStrictEqual(
SendReducer(mockState, { SendReducer(mockState, {
type: 'someOtherAction', type: 'someOtherAction',
value: 'someValue', value: 'someValue',
@ -40,7 +40,7 @@ describe('Send Duck', function () {
}) })
it('should set toDropdownOpen to true when receiving a OPEN_TO_DROPDOWN action', function () { it('should set toDropdownOpen to true when receiving a OPEN_TO_DROPDOWN action', function () {
assert.deepEqual( assert.deepStrictEqual(
SendReducer(mockState, { SendReducer(mockState, {
type: OPEN_TO_DROPDOWN, 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 () { it('should set toDropdownOpen to false when receiving a CLOSE_TO_DROPDOWN action', function () {
assert.deepEqual( assert.deepStrictEqual(
SendReducer(mockState, { SendReducer(mockState, {
type: CLOSE_TO_DROPDOWN, 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 () { it('should set gasButtonGroupShown to true when receiving a SHOW_GAS_BUTTON_GROUP action', function () {
assert.deepEqual( assert.deepStrictEqual(
SendReducer( SendReducer(
{ ...mockState, gasButtonGroupShown: false }, { ...mockState, gasButtonGroupShown: false },
{ type: SHOW_GAS_BUTTON_GROUP }, { 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 () { 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 }), SendReducer(mockState, { type: HIDE_GAS_BUTTON_GROUP }),
{ gasButtonGroupShown: false, ...mockState }, { gasButtonGroupShown: false, ...mockState },
) )
@ -81,7 +81,7 @@ describe('Send Duck', function () {
someError: false, someError: false,
}, },
} }
assert.deepEqual( assert.deepStrictEqual(
SendReducer(modifiedMockState, { SendReducer(modifiedMockState, {
type: UPDATE_SEND_ERRORS, type: UPDATE_SEND_ERRORS,
value: { someOtherError: true }, 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 () { it('should return the initial state in response to a RESET_SEND_STATE action', function () {
assert.deepEqual( assert.deepStrictEqual(
SendReducer(mockState, { SendReducer(mockState, {
type: RESET_SEND_STATE, type: RESET_SEND_STATE,
}), }),
@ -107,23 +107,27 @@ describe('Send Duck', function () {
}) })
describe('openToDropdown', function () { describe('openToDropdown', function () {
assert.deepEqual(openToDropdown(), { type: OPEN_TO_DROPDOWN }) assert.deepStrictEqual(openToDropdown(), { type: OPEN_TO_DROPDOWN })
}) })
describe('closeToDropdown', function () { describe('closeToDropdown', function () {
assert.deepEqual(closeToDropdown(), { type: CLOSE_TO_DROPDOWN }) assert.deepStrictEqual(closeToDropdown(), { type: CLOSE_TO_DROPDOWN })
}) })
describe('showGasButtonGroup', function () { describe('showGasButtonGroup', function () {
assert.deepEqual(showGasButtonGroup(), { type: SHOW_GAS_BUTTON_GROUP }) assert.deepStrictEqual(showGasButtonGroup(), {
type: SHOW_GAS_BUTTON_GROUP,
})
}) })
describe('hideGasButtonGroup', function () { describe('hideGasButtonGroup', function () {
assert.deepEqual(hideGasButtonGroup(), { type: HIDE_GAS_BUTTON_GROUP }) assert.deepStrictEqual(hideGasButtonGroup(), {
type: HIDE_GAS_BUTTON_GROUP,
})
}) })
describe('updateSendErrors', function () { describe('updateSendErrors', function () {
assert.deepEqual(updateSendErrors('mockErrorObject'), { assert.deepStrictEqual(updateSendErrors('mockErrorObject'), {
type: UPDATE_SEND_ERRORS, type: UPDATE_SEND_ERRORS,
value: 'mockErrorObject', value: 'mockErrorObject',
}) })

@ -27,12 +27,12 @@ describe('withModalProps', function () {
assert.ok(wrapper) assert.ok(wrapper)
const testComponent = wrapper.find(TestComponent).at(0) const testComponent = wrapper.find(TestComponent).at(0)
assert.equal(testComponent.length, 1) assert.strictEqual(testComponent.length, 1)
assert.equal(testComponent.find('.test').text(), 'Testing') assert.strictEqual(testComponent.find('.test').text(), 'Testing')
const testComponentProps = testComponent.props() const testComponentProps = testComponent.props()
assert.equal(testComponentProps.prop1, 'prop1') assert.strictEqual(testComponentProps.prop1, 'prop1')
assert.equal(testComponentProps.prop2, 2) assert.strictEqual(testComponentProps.prop2, 2)
assert.equal(testComponentProps.prop3, true) assert.strictEqual(testComponentProps.prop3, true)
assert.equal(typeof testComponentProps.hideModal, 'function') assert.strictEqual(typeof testComponentProps.hideModal, 'function')
}) })
}) })

@ -20,7 +20,7 @@ describe('Common utils', function () {
] ]
tests.forEach(({ test, expected }) => { tests.forEach(({ test, expected }) => {
assert.equal(utils.camelCaseToCapitalize(test), expected) assert.strictEqual(utils.camelCaseToCapitalize(test), expected)
}) })
}) })
}) })

@ -5,43 +5,43 @@ describe('Confirm Transaction utils', function () {
describe('increaseLastGasPrice', function () { describe('increaseLastGasPrice', function () {
it('should increase the gasPrice by 10%', function () { it('should increase the gasPrice by 10%', function () {
const increasedGasPrice = utils.increaseLastGasPrice('0xa') const increasedGasPrice = utils.increaseLastGasPrice('0xa')
assert.equal(increasedGasPrice, '0xb') assert.strictEqual(increasedGasPrice, '0xb')
}) })
it('should prefix the result with 0x', function () { it('should prefix the result with 0x', function () {
const increasedGasPrice = utils.increaseLastGasPrice('a') const increasedGasPrice = utils.increaseLastGasPrice('a')
assert.equal(increasedGasPrice, '0xb') assert.strictEqual(increasedGasPrice, '0xb')
}) })
}) })
describe('hexGreaterThan', function () { describe('hexGreaterThan', function () {
it('should return true if the first value is greater than the second value', 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 () { 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 () { 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 () { 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 () { describe('getHexGasTotal', function () {
it('should multiply the hex gasLimit and hex gasPrice values together', function () { it('should multiply the hex gasLimit and hex gasPrice values together', function () {
assert.equal( assert.strictEqual(
utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }), utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }),
'0x1319718a5000', '0x1319718a5000',
) )
}) })
it('should prefix the result with 0x', function () { it('should prefix the result with 0x', function () {
assert.equal( assert.strictEqual(
utils.getHexGasTotal({ gasLimit: '5208', gasPrice: '3b9aca00' }), utils.getHexGasTotal({ gasLimit: '5208', gasPrice: '3b9aca00' }),
'0x1319718a5000', '0x1319718a5000',
) )
@ -50,11 +50,11 @@ describe('Confirm Transaction utils', function () {
describe('addEth', function () { describe('addEth', function () {
it('should add two values together rounding to 6 decimal places', 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 () { it('should add any number of values together rounding to 6 decimal places', function () {
assert.equal( assert.strictEqual(
utils.addEth( utils.addEth(
'0.1', '0.1',
'0.02', '0.02',
@ -71,11 +71,11 @@ describe('Confirm Transaction utils', function () {
describe('addFiat', function () { describe('addFiat', function () {
it('should add two values together rounding to 2 decimal places', 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 () { it('should add any number of values together rounding to 2 decimal places', function () {
assert.equal( assert.strictEqual(
utils.addFiat( utils.addFiat(
'0.1', '0.1',
'0.02', '0.02',
@ -99,7 +99,7 @@ describe('Confirm Transaction utils', function () {
numberOfDecimals: 6, numberOfDecimals: 6,
}) })
assert.equal(ethTransactionAmount, '1') assert.strictEqual(ethTransactionAmount, '1')
}) })
it('should get the transaction amount in fiat', function () { it('should get the transaction amount in fiat', function () {
@ -110,7 +110,7 @@ describe('Confirm Transaction utils', function () {
numberOfDecimals: 2, numberOfDecimals: 2,
}) })
assert.equal(fiatTransactionAmount, '468.58') assert.strictEqual(fiatTransactionAmount, '468.58')
}) })
}) })
@ -123,7 +123,7 @@ describe('Confirm Transaction utils', function () {
numberOfDecimals: 6, numberOfDecimals: 6,
}) })
assert.equal(ethTransactionFee, '0.000021') assert.strictEqual(ethTransactionFee, '0.000021')
}) })
it('should get the transaction fee in fiat', function () { it('should get the transaction fee in fiat', function () {
@ -134,14 +134,14 @@ describe('Confirm Transaction utils', function () {
numberOfDecimals: 2, numberOfDecimals: 2,
}) })
assert.equal(fiatTransactionFee, '0.01') assert.strictEqual(fiatTransactionFee, '0.01')
}) })
}) })
describe('formatCurrency', function () { describe('formatCurrency', function () {
it('should format USD values', function () { it('should format USD values', function () {
const value = utils.formatCurrency('123.45', 'usd') const value = utils.formatCurrency('123.45', 'usd')
assert.equal(value, '$123.45') assert.strictEqual(value, '$123.45')
}) })
}) })
}) })

@ -9,7 +9,7 @@ describe('conversion utils', function () {
aBase: 10, aBase: 10,
bBase: 10, bBase: 10,
}) })
assert.equal(result.toNumber(), 12) assert.strictEqual(result.toNumber(), 12)
}) })
it('add decimals', function () { it('add decimals', function () {
@ -17,7 +17,7 @@ describe('conversion utils', function () {
aBase: 10, aBase: 10,
bBase: 10, bBase: 10,
}) })
assert.equal(result.toNumber(), 3.2) assert.strictEqual(result.toNumber(), 3.2)
}) })
it('add repeating decimals', function () { it('add repeating decimals', function () {
@ -25,7 +25,7 @@ describe('conversion utils', function () {
aBase: 10, aBase: 10,
bBase: 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') assert(conv2 instanceof BigNumber, 'conversion 2 should be a BigNumber')
}) })
it('Converts from dec to hex', function () { it('Converts from dec to hex', function () {
assert.equal( assert.strictEqual(
conversionUtil('1000000000000000000', { conversionUtil('1000000000000000000', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'hex', toNumericBase: 'hex',
}), }),
'de0b6b3a7640000', 'de0b6b3a7640000',
) )
assert.equal( assert.strictEqual(
conversionUtil('1500000000000000000', { conversionUtil('1500000000000000000', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'hex', toNumericBase: 'hex',
@ -63,79 +63,79 @@ describe('conversion utils', function () {
) )
}) })
it('Converts hex formatted numbers to dec', function () { it('Converts hex formatted numbers to dec', function () {
assert.equal( assert.strictEqual(
conversionUtil('0xde0b6b3a7640000', { conversionUtil('0xde0b6b3a7640000', {
fromNumericBase: 'hex', fromNumericBase: 'hex',
toNumericBase: 'dec', toNumericBase: 'dec',
}), }),
1000000000000000000, '1000000000000000000',
) )
assert.equal( assert.strictEqual(
conversionUtil('0x14d1120d7b160000', { conversionUtil('0x14d1120d7b160000', {
fromNumericBase: 'hex', fromNumericBase: 'hex',
toNumericBase: 'dec', toNumericBase: 'dec',
}), }),
1500000000000000000, '1500000000000000000',
) )
}) })
it('Converts WEI to ETH', function () { it('Converts WEI to ETH', function () {
assert.equal( assert.strictEqual(
conversionUtil('0xde0b6b3a7640000', { conversionUtil('0xde0b6b3a7640000', {
fromNumericBase: 'hex', fromNumericBase: 'hex',
toNumericBase: 'dec', toNumericBase: 'dec',
fromDenomination: 'WEI', fromDenomination: 'WEI',
toDenomination: 'ETH', toDenomination: 'ETH',
}), }),
1, '1',
) )
assert.equal( assert.strictEqual(
conversionUtil('0x14d1120d7b160000', { conversionUtil('0x14d1120d7b160000', {
fromNumericBase: 'hex', fromNumericBase: 'hex',
toNumericBase: 'dec', toNumericBase: 'dec',
fromDenomination: 'WEI', fromDenomination: 'WEI',
toDenomination: 'ETH', toDenomination: 'ETH',
}), }),
1.5, '1.5',
) )
}) })
it('Converts ETH to WEI', function () { it('Converts ETH to WEI', function () {
assert.equal( assert.strictEqual(
conversionUtil('1', { conversionUtil('1', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
fromDenomination: 'ETH', fromDenomination: 'ETH',
toDenomination: 'WEI', toDenomination: 'WEI',
}), }).toNumber(),
1000000000000000000, 1000000000000000000,
) )
assert.equal( assert.strictEqual(
conversionUtil('1.5', { conversionUtil('1.5', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
fromDenomination: 'ETH', fromDenomination: 'ETH',
toDenomination: 'WEI', toDenomination: 'WEI',
}), }).toNumber(),
1500000000000000000, 1500000000000000000,
) )
}) })
it('Converts ETH to GWEI', function () { it('Converts ETH to GWEI', function () {
assert.equal( assert.strictEqual(
conversionUtil('1', { conversionUtil('1', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
fromDenomination: 'ETH', fromDenomination: 'ETH',
toDenomination: 'GWEI', toDenomination: 'GWEI',
}), }).toNumber(),
1000000000, 1000000000,
) )
assert.equal( assert.strictEqual(
conversionUtil('1.5', { conversionUtil('1.5', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
fromDenomination: 'ETH', fromDenomination: 'ETH',
toDenomination: 'GWEI', toDenomination: 'GWEI',
}), }).toNumber(),
1500000000, 1500000000,
) )
}) })
it('Converts ETH to USD', function () { it('Converts ETH to USD', function () {
assert.equal( assert.strictEqual(
conversionUtil('1', { conversionUtil('1', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'dec', toNumericBase: 'dec',
@ -143,9 +143,9 @@ describe('conversion utils', function () {
conversionRate: 468.58, conversionRate: 468.58,
numberOfDecimals: 2, numberOfDecimals: 2,
}), }),
468.58, '468.58',
) )
assert.equal( assert.strictEqual(
conversionUtil('1.5', { conversionUtil('1.5', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'dec', toNumericBase: 'dec',
@ -153,11 +153,11 @@ describe('conversion utils', function () {
conversionRate: 468.58, conversionRate: 468.58,
numberOfDecimals: 2, numberOfDecimals: 2,
}), }),
702.87, '702.87',
) )
}) })
it('Converts USD to ETH', function () { it('Converts USD to ETH', function () {
assert.equal( assert.strictEqual(
conversionUtil('468.58', { conversionUtil('468.58', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'dec', toNumericBase: 'dec',
@ -166,9 +166,9 @@ describe('conversion utils', function () {
numberOfDecimals: 2, numberOfDecimals: 2,
invertConversionRate: true, invertConversionRate: true,
}), }),
1, '1',
) )
assert.equal( assert.strictEqual(
conversionUtil('702.87', { conversionUtil('702.87', {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'dec', toNumericBase: 'dec',
@ -177,7 +177,7 @@ describe('conversion utils', function () {
numberOfDecimals: 2, numberOfDecimals: 2,
invertConversionRate: true, invertConversionRate: true,
}), }),
1.5, '1.5',
) )
}) })
}) })

@ -10,34 +10,34 @@ describe('conversion utils', function () {
fromCurrency: ETH, fromCurrency: ETH,
fromDenomination: ETH, fromDenomination: ETH,
}) })
assert.equal(weiValue, '0') assert.strictEqual(weiValue, '0')
}) })
}) })
describe('decETHToDecWEI', function () { describe('decETHToDecWEI', function () {
it('should correctly convert 1 ETH to WEI', function () { it('should correctly convert 1 ETH to WEI', function () {
const weiValue = utils.decETHToDecWEI('1') const weiValue = utils.decETHToDecWEI('1')
assert.equal(weiValue, '1000000000000000000') assert.strictEqual(weiValue, '1000000000000000000')
}) })
it('should correctly convert 0.000000000000000001 ETH to WEI', function () { it('should correctly convert 0.000000000000000001 ETH to WEI', function () {
const weiValue = utils.decETHToDecWEI('0.000000000000000001') const weiValue = utils.decETHToDecWEI('0.000000000000000001')
assert.equal(weiValue, '1') assert.strictEqual(weiValue, '1')
}) })
it('should correctly convert 1000000.000000000000000001 ETH to WEI', function () { it('should correctly convert 1000000.000000000000000001 ETH to WEI', function () {
const weiValue = utils.decETHToDecWEI('1000000.000000000000000001') const weiValue = utils.decETHToDecWEI('1000000.000000000000000001')
assert.equal(weiValue, '1000000000000000000000001') assert.strictEqual(weiValue, '1000000000000000000000001')
}) })
it('should correctly convert 9876.543210 ETH to WEI', function () { it('should correctly convert 9876.543210 ETH to WEI', function () {
const weiValue = utils.decETHToDecWEI('9876.543210') const weiValue = utils.decETHToDecWEI('9876.543210')
assert.equal(weiValue, '9876543210000000000000') assert.strictEqual(weiValue, '9876543210000000000000')
}) })
it('should correctly convert 1.0000000000000000 ETH to WEI', function () { it('should correctly convert 1.0000000000000000 ETH to WEI', function () {
const weiValue = utils.decETHToDecWEI('1.0000000000000000') const weiValue = utils.decETHToDecWEI('1.0000000000000000')
assert.equal(weiValue, '1000000000000000000') assert.strictEqual(weiValue, '1000000000000000000')
}) })
}) })
}) })

@ -26,7 +26,7 @@ describe('Fetch with cache', function () {
const response = await fetchWithCache( const response = await fetchWithCache(
'https://fetchwithcache.metamask.io/price', 'https://fetchwithcache.metamask.io/price',
) )
assert.deepEqual(response, { assert.deepStrictEqual(response, {
average: 1, average: 1,
}) })
}) })
@ -46,7 +46,7 @@ describe('Fetch with cache', function () {
const response = await fetchWithCache( const response = await fetchWithCache(
'https://fetchwithcache.metamask.io/price', 'https://fetchwithcache.metamask.io/price',
) )
assert.deepEqual(response, { assert.deepStrictEqual(response, {
average: 1, average: 1,
}) })
}) })
@ -68,7 +68,7 @@ describe('Fetch with cache', function () {
{}, {},
{ cacheRefreshTime: 123 }, { cacheRefreshTime: 123 },
) )
assert.deepEqual(response, { assert.deepStrictEqual(response, {
average: 3, average: 3,
}) })
}) })

@ -100,12 +100,12 @@ describe('i18n helper', function () {
describe('getMessage', function () { describe('getMessage', function () {
it('should return the exact message paired with key if there are no substitutions', function () { it('should return the exact message paired with key if there are no substitutions', function () {
const result = t(TEST_KEY_1) 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 () { it('should return the correct message when a single non-react substitution is made', function () {
const result = t(TEST_KEY_2, [TEST_SUBSTITUTION_1]) const result = t(TEST_KEY_2, [TEST_SUBSTITUTION_1])
assert.equal( assert.strictEqual(
result, result,
`This is a message with a single non-react substitution ${TEST_SUBSTITUTION_1}.`, `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 () { 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]) const result = t(TEST_KEY_3, [TEST_SUBSTITUTION_1, TEST_SUBSTITUTION_2])
assert.equal( assert.strictEqual(
result, result,
`This is a message with two non-react substitutions ${TEST_SUBSTITUTION_1} and ${TEST_SUBSTITUTION_2}.`, `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_4,
TEST_SUBSTITUTION_5, TEST_SUBSTITUTION_5,
]) ])
assert.equal( assert.strictEqual(
result, result,
`${TEST_SUBSTITUTION_1} - ${TEST_SUBSTITUTION_2} - ${TEST_SUBSTITUTION_3} - ${TEST_SUBSTITUTION_4} - ${TEST_SUBSTITUTION_5}`, `${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 () { it('should correctly render falsey substitutions', function () {
const result = t(TEST_KEY_4, [0, -0, '', false, NaN]) 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 () { it('should render nothing for "null" and "undefined" substitutions', function () {
const result = t(TEST_KEY_5, [null, TEST_SUBSTITUTION_2]) 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 () { it('should return the correct message when a single react substitution is made', function () {
const result = t(TEST_KEY_6, [TEST_SUBSTITUTION_6]) const result = t(TEST_KEY_6, [TEST_SUBSTITUTION_6])
assert.equal( assert.strictEqual(
shallow(result).html(), shallow(result).html(),
'<span> Testing a react substitution <div style="color:red">TEST_SUBSTITUTION_1</div>. </span>', '<span> Testing a react substitution <div style="color:red">TEST_SUBSTITUTION_1</div>. </span>',
) )
@ -156,7 +156,7 @@ describe('i18n helper', function () {
TEST_SUBSTITUTION_7_1, TEST_SUBSTITUTION_7_1,
TEST_SUBSTITUTION_7_2, TEST_SUBSTITUTION_7_2,
]) ])
assert.equal( assert.strictEqual(
shallow(result).html(), shallow(result).html(),
'<span> Testing a react substitution <div style="color:red">TEST_SUBSTITUTION_1</div> and another <div style="color:blue">TEST_SUBSTITUTION_2</div>. </span>', '<span> Testing a react substitution <div style="color:red">TEST_SUBSTITUTION_1</div> and another <div style="color:blue">TEST_SUBSTITUTION_2</div>. </span>',
) )
@ -169,7 +169,7 @@ describe('i18n helper', function () {
TEST_SUBSTITUTION_2, TEST_SUBSTITUTION_2,
TEST_SUBSTITUTION_8_2, TEST_SUBSTITUTION_8_2,
]) ])
assert.equal( assert.strictEqual(
shallow(result).html(), shallow(result).html(),
'<span> Testing a mix TEST_SUBSTITUTION_1 of react substitutions <div style="color:orange">TEST_SUBSTITUTION_3</div> and string substitutions TEST_SUBSTITUTION_2 + <div style="color:pink">TEST_SUBSTITUTION_4</div>. </span>', '<span> Testing a mix TEST_SUBSTITUTION_1 of react substitutions <div style="color:orange">TEST_SUBSTITUTION_3</div> and string substitutions TEST_SUBSTITUTION_2 + <div style="color:pink">TEST_SUBSTITUTION_4</div>. </span>',
) )

@ -14,11 +14,11 @@ describe('Transactions utils', function () {
) )
assert.ok(tokenData) assert.ok(tokenData)
const { name, args } = 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 to = args._to
const value = args._value.toString() const value = args._value.toString()
assert.equal(to, '0x50A9D56C2B8BA9A5c7f2C08C3d26E0499F23a706') assert.strictEqual(to, '0x50A9D56C2B8BA9A5c7f2C08C3d26E0499F23a706')
assert.equal(value, '20000') assert.strictEqual(value, '20000')
}) })
it('should not throw errors when called without arguments', function () { it('should not throw errors when called without arguments', function () {
@ -56,7 +56,7 @@ describe('Transactions utils', function () {
] ]
tests.forEach(({ transaction, expected }) => { 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 }) => { tests.forEach(({ expected, networkId, hash, rpcPrefs }) => {
assert.equal( assert.strictEqual(
utils.getBlockExplorerUrlForTx(networkId, hash, rpcPrefs), utils.getBlockExplorerUrlForTx(networkId, hash, rpcPrefs),
expected, expected,
) )

@ -12,25 +12,25 @@ describe('util', function () {
it('should render 0.01 eth correctly', function () { it('should render 0.01 eth correctly', function () {
const input = '0x2386F26FC10000' const input = '0x2386F26FC10000'
const output = util.parseBalance(input) const output = util.parseBalance(input)
assert.deepEqual(output, ['0', '01']) assert.deepStrictEqual(output, ['0', '01'])
}) })
it('should render 12.023 eth correctly', function () { it('should render 12.023 eth correctly', function () {
const input = 'A6DA46CCA6858000' const input = 'A6DA46CCA6858000'
const output = util.parseBalance(input) const output = util.parseBalance(input)
assert.deepEqual(output, ['12', '023']) assert.deepStrictEqual(output, ['12', '023'])
}) })
it('should render 0.0000000342422 eth correctly', function () { it('should render 0.0000000342422 eth correctly', function () {
const input = '0x7F8FE81C0' const input = '0x7F8FE81C0'
const output = util.parseBalance(input) const output = util.parseBalance(input)
assert.deepEqual(output, ['0', '0000000342422']) assert.deepStrictEqual(output, ['0', '0000000342422'])
}) })
it('should render 0 eth correctly', function () { it('should render 0 eth correctly', function () {
const input = '0x0' const input = '0x0'
const output = util.parseBalance(input) 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 () { it('should add case-sensitive checksum', function () {
const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825' const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
const result = util.addressSummary(address) 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 () { it('should accept arguments for firstseg, lastseg, and keepPrefix', function () {
const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825' const address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
const result = util.addressSummary(address, 4, 4, false) 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 address = '0x5Fda30Bb72B8Dfe20e48A00dFc108d0915BE9Bb0'
const result = util.isValidAddress(address) const result = util.isValidAddress(address)
const hashed = ethUtil.toChecksumAddress(address.toLowerCase()) 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') assert.ok(result, 'is valid by our check')
}) })
}) })
@ -155,30 +155,30 @@ describe('util', function () {
describe('#numericBalance', function () { describe('#numericBalance', function () {
it('should return a BN 0 if given nothing', function () { it('should return a BN 0 if given nothing', function () {
const result = util.numericBalance() const result = util.numericBalance()
assert.equal(result.toString(10), 0) assert.strictEqual(result.toString(10), '0')
}) })
it('should work with hex prefix', function () { it('should work with hex prefix', function () {
const result = util.numericBalance('0x012') 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 () { it('should work with no hex prefix', function () {
const result = util.numericBalance('012') const result = util.numericBalance('012')
assert.equal(result.toString(10), '18') assert.strictEqual(result.toString(10), '18')
}) })
}) })
describe('#formatBalance', function () { describe('#formatBalance', function () {
it('should return None when given nothing', function () { it('should return None when given nothing', function () {
const result = util.formatBalance() 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 () { it('should return 1.0000 ETH', function () {
const input = new ethUtil.BN(ethInWei, 10).toJSON() const input = new ethUtil.BN(ethInWei, 10).toJSON()
const result = util.formatBalance(input, 4) 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 () { it('should return 0.500 ETH', function () {
@ -186,29 +186,29 @@ describe('util', function () {
.div(new ethUtil.BN('2', 10)) .div(new ethUtil.BN('2', 10))
.toJSON() .toJSON()
const result = util.formatBalance(input, 3) 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 () { it('should display specified decimal points', function () {
const input = '0x128dfa6a90b28000' const input = '0x128dfa6a90b28000'
const result = util.formatBalance(input, 2) 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 () { it('should default to 3 decimal points', function () {
const input = '0x128dfa6a90b28000' const input = '0x128dfa6a90b28000'
const result = util.formatBalance(input) 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 () { it('should show 2 significant digits for tiny balances', function () {
const input = '0x1230fa6a90b28' const input = '0x1230fa6a90b28'
const result = util.formatBalance(input) 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 () { it('should not parse the balance and return value with 2 decimal points with ETH at the end', function () {
const value = '1.2456789' const value = '1.2456789'
const needsParse = false const needsParse = false
const result = util.formatBalance(value, 2, needsParse) 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) => { Object.keys(valueTable).forEach((currency) => {
const value = new ethUtil.BN(valueTable[currency], 10) const value = new ethUtil.BN(valueTable[currency], 10)
const output = util.normalizeToWei(value, currency) const output = util.normalizeToWei(value, currency)
assert.equal( assert.strictEqual(
output.toString(10), output.toString(10),
valueTable.wei, valueTable.wei,
`value of ${output.toString( `value of ${output.toString(
@ -250,25 +250,25 @@ describe('util', function () {
it('should convert decimal eth to pure wei BN', function () { it('should convert decimal eth to pure wei BN', function () {
const input = '1.23456789' const input = '1.23456789'
const output = util.normalizeEthStringToWei(input) 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 () { it('should convert 1 to expected wei', function () {
const input = '1' const input = '1'
const output = util.normalizeEthStringToWei(input) 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 () { it('should account for overflow numbers gracefully by dropping extra precision.', function () {
const input = '1.11111111111111111111' const input = '1.11111111111111111111'
const output = util.normalizeEthStringToWei(input) 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 () { it('should not truncate very exact wei values that do not have extra precision.', function () {
const input = '1.100000000000000001' const input = '1.100000000000000001'
const output = util.normalizeEthStringToWei(input) 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 input = 0.0002
const output = util.normalizeNumberToWei(input, 'ether') const output = util.normalizeNumberToWei(input, 'ether')
const str = output.toString(10) 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 () { it('should convert a kwei number to the appropriate equivalent wei', function () {
const result = util.normalizeNumberToWei(1.111, 'kwei') 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 () { it('should convert a ether number to the appropriate equivalent wei', function () {
const result = util.normalizeNumberToWei(1.111, 'ether') const result = util.normalizeNumberToWei(1.111, 'ether')
assert.equal( assert.strictEqual(
result.toString(10), result.toString(10),
'1111000000000000000', '1111000000000000000',
'accepts decimals', 'accepts decimals',
@ -408,14 +408,17 @@ describe('util', function () {
testData.forEach(({ args, result }) => { testData.forEach(({ args, result }) => {
it(`should return ${result} when passed number ${args[0]} and precision ${args[1]}`, function () { 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 () { describe('addHexPrefixToObjectValues()', function () {
it('should return a new object with the same properties with a 0x prefix', function () { it('should return a new object with the same properties with a 0x prefix', function () {
assert.deepEqual( assert.deepStrictEqual(
util.addHexPrefixToObjectValues({ util.addHexPrefixToObjectValues({
prop1: '0x123', prop1: '0x123',
prop2: '456', prop2: '456',

@ -44,18 +44,18 @@ describe('useCancelTransaction', function () {
const { result } = renderHook(() => const { result } = renderHook(() =>
useCancelTransaction(transactionGroup), 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 () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () {
const { result } = renderHook(() => const { result } = renderHook(() =>
useCancelTransaction(transactionGroup), useCancelTransaction(transactionGroup),
) )
assert.equal(typeof result.current[1], 'function') assert.strictEqual(typeof result.current[1], 'function')
result.current[1]({ result.current[1]({
preventDefault: () => undefined, preventDefault: () => undefined,
stopPropagation: () => undefined, stopPropagation: () => undefined,
}) })
assert.equal( assert.strictEqual(
dispatch.calledWith( dispatch.calledWith(
showModal({ showModal({
name: 'CANCEL_TRANSACTION', name: 'CANCEL_TRANSACTION',
@ -96,18 +96,18 @@ describe('useCancelTransaction', function () {
const { result } = renderHook(() => const { result } = renderHook(() =>
useCancelTransaction(transactionGroup), 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 () { it(`should return a function that kicks off cancellation for id ${transactionId}`, function () {
const { result } = renderHook(() => const { result } = renderHook(() =>
useCancelTransaction(transactionGroup), useCancelTransaction(transactionGroup),
) )
assert.equal(typeof result.current[1], 'function') assert.strictEqual(typeof result.current[1], 'function')
result.current[1]({ result.current[1]({
preventDefault: () => undefined, preventDefault: () => undefined,
stopPropagation: () => undefined, stopPropagation: () => undefined,
}) })
assert.equal( assert.strictEqual(
dispatch.calledWith( dispatch.calledWith(
showModal({ showModal({
name: 'CANCEL_TRANSACTION', name: 'CANCEL_TRANSACTION',

@ -117,13 +117,13 @@ describe('useCurrencyDisplay', function () {
const [displayValue, parts] = hookReturn.result.current const [displayValue, parts] = hookReturn.result.current
stub.restore() stub.restore()
it(`should return ${result.displayValue} as displayValue`, function () { 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 () { 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 () { it(`should return ${result.suffix} as suffix`, function () {
assert.equal(parts.suffix, result.suffix) assert.strictEqual(parts.suffix, result.suffix)
}) })
}) })
}) })

@ -43,7 +43,7 @@ describe('useRetryTransaction', function () {
) )
const retry = result.current const retry = result.current
retry(event) retry(event)
assert.equal(trackEvent.calledOnce, true) assert.strictEqual(trackEvent.calledOnce, true)
}) })
it('retryTransaction function should show retry sidebar', async function () { it('retryTransaction function should show retry sidebar', async function () {
@ -52,7 +52,7 @@ describe('useRetryTransaction', function () {
) )
const retry = result.current const retry = result.current
await retry(event) await retry(event)
assert.equal( assert.strictEqual(
dispatch.calledWith( dispatch.calledWith(
showSidebar({ showSidebar({
transitionName: 'sidebar-left', transitionName: 'sidebar-left',

@ -53,14 +53,14 @@ describe('useTokenData', function () {
it(testTitle, function () { it(testTitle, function () {
const { result } = renderHook(() => useTokenData(test.data)) const { result } = renderHook(() => useTokenData(test.data))
if (test.tokenData) { if (test.tokenData) {
assert.equal(result.current.name, test.tokenData.name) assert.strictEqual(result.current.name, test.tokenData.name)
assert.equal( assert.strictEqual(
result.current.args[0].toLowerCase(), result.current.args[0].toLowerCase(),
test.tokenData.args[0], test.tokenData.args[0],
) )
assert.ok(test.tokenData.args[1].eq(result.current.args[1])) assert.ok(test.tokenData.args[1].eq(result.current.args[1]))
} else { } else {
assert.equal(result.current, test.tokenData) assert.strictEqual(result.current, test.tokenData)
} }
}) })
}) })

@ -130,7 +130,7 @@ describe('useTokenDisplayValue', function () {
useTokenDisplayValue(`${idx}-fakestring`, test.token), useTokenDisplayValue(`${idx}-fakestring`, test.token),
) )
sinon.restore() sinon.restore()
assert.equal(result.current, test.displayValue) assert.strictEqual(result.current, test.displayValue)
}) })
}) })
}) })

@ -178,35 +178,38 @@ describe('useTransactionDisplayData', function () {
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal(result.current.title, expected.title) assert.strictEqual(result.current.title, expected.title)
}) })
it(`should return a subtitle of ${expected.subtitle}`, function () { it(`should return a subtitle of ${expected.subtitle}`, function () {
const { result } = renderHookWithRouter( const { result } = renderHookWithRouter(
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal(result.current.subtitle, expected.subtitle) assert.strictEqual(result.current.subtitle, expected.subtitle)
}) })
it(`should return a category of ${expected.category}`, function () { it(`should return a category of ${expected.category}`, function () {
const { result } = renderHookWithRouter( const { result } = renderHookWithRouter(
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal(result.current.category, expected.category) assert.strictEqual(result.current.category, expected.category)
}) })
it(`should return a primaryCurrency of ${expected.primaryCurrency}`, function () { it(`should return a primaryCurrency of ${expected.primaryCurrency}`, function () {
const { result } = renderHookWithRouter( const { result } = renderHookWithRouter(
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal(result.current.primaryCurrency, expected.primaryCurrency) assert.strictEqual(
result.current.primaryCurrency,
expected.primaryCurrency,
)
}) })
it(`should return a secondaryCurrency of ${expected.secondaryCurrency}`, function () { it(`should return a secondaryCurrency of ${expected.secondaryCurrency}`, function () {
const { result } = renderHookWithRouter( const { result } = renderHookWithRouter(
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal( assert.strictEqual(
result.current.secondaryCurrency, result.current.secondaryCurrency,
expected.secondaryCurrency, expected.secondaryCurrency,
) )
@ -216,7 +219,7 @@ describe('useTransactionDisplayData', function () {
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal( assert.strictEqual(
result.current.displayedStatusKey, result.current.displayedStatusKey,
expected.displayedStatusKey, expected.displayedStatusKey,
) )
@ -226,14 +229,17 @@ describe('useTransactionDisplayData', function () {
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, tokenAddress,
) )
assert.equal(result.current.recipientAddress, expected.recipientAddress) assert.strictEqual(
result.current.recipientAddress,
expected.recipientAddress,
)
}) })
it(`should return a senderAddress of ${expected.senderAddress}`, function () { it(`should return a senderAddress of ${expected.senderAddress}`, function () {
const { result } = renderHookWithRouter( const { result } = renderHookWithRouter(
() => useTransactionDisplayData(transactionGroup), () => useTransactionDisplayData(transactionGroup),
tokenAddress, 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(() => const { result } = renderHookWithRouter(() =>
useTransactionDisplayData(transactions[0]), useTransactionDisplayData(transactions[0]),
) )
assert.deepEqual(result.current, expectedResults[0]) assert.deepStrictEqual(result.current, expectedResults[0])
}) })
after(function () { after(function () {
useSelector.restore() useSelector.restore()

@ -135,12 +135,12 @@ describe('useUserPreferencedCurrency', function () {
it(`should return currency as ${ it(`should return currency as ${
result.currency || 'not modified by user preferences' result.currency || 'not modified by user preferences'
}`, function () { }`, function () {
assert.equal(hookResult.current.currency, result.currency) assert.strictEqual(hookResult.current.currency, result.currency)
}) })
it(`should return decimals as ${ it(`should return decimals as ${
result.numberOfDecimals || 'not modified by user preferences' result.numberOfDecimals || 'not modified by user preferences'
}`, function () { }`, function () {
assert.equal( assert.strictEqual(
hookResult.current.numberOfDecimals, hookResult.current.numberOfDecimals,
result.numberOfDecimals, result.numberOfDecimals,
) )

@ -49,7 +49,7 @@ describe('Add Token', function () {
'.button.btn-secondary.page-container__footer-button', '.button.btn-secondary.page-container__footer-button',
) )
assert.equal(nextButton.props().disabled, true) assert.strictEqual(nextButton.props().disabled, true)
}) })
it('edits token address', function () { it('edits token address', function () {
@ -58,7 +58,7 @@ describe('Add Token', function () {
const customAddress = wrapper.find('input#custom-address') const customAddress = wrapper.find('input#custom-address')
customAddress.simulate('change', event) customAddress.simulate('change', event)
assert.equal( assert.strictEqual(
wrapper.find('AddToken').instance().state.customAddress, wrapper.find('AddToken').instance().state.customAddress,
tokenAddress, tokenAddress,
) )
@ -70,7 +70,7 @@ describe('Add Token', function () {
const customAddress = wrapper.find('#custom-symbol') const customAddress = wrapper.find('#custom-symbol')
customAddress.last().simulate('change', event) customAddress.last().simulate('change', event)
assert.equal( assert.strictEqual(
wrapper.find('AddToken').instance().state.customSymbol, wrapper.find('AddToken').instance().state.customSymbol,
tokenSymbol, tokenSymbol,
) )
@ -82,7 +82,7 @@ describe('Add Token', function () {
const customAddress = wrapper.find('#custom-decimals') const customAddress = wrapper.find('#custom-decimals')
customAddress.last().simulate('change', event) customAddress.last().simulate('change', event)
assert.equal( assert.strictEqual(
wrapper.find('AddToken').instance().state.customDecimals, wrapper.find('AddToken').instance().state.customDecimals,
tokenPrecision, tokenPrecision,
) )
@ -96,7 +96,10 @@ describe('Add Token', function () {
assert(props.setPendingTokens.calledOnce) assert(props.setPendingTokens.calledOnce)
assert(props.history.push.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 () { it('cancels', function () {
@ -106,7 +109,7 @@ describe('Add Token', function () {
cancelButton.simulate('click') cancelButton.simulate('click')
assert(props.clearPendingTokens.calledOnce) assert(props.clearPendingTokens.calledOnce)
assert.equal(props.history.push.getCall(0).args[0], '/') assert.strictEqual(props.history.push.getCall(0).args[0], '/')
}) })
}) })
}) })

@ -4,11 +4,11 @@ import { getMethodName } from '../confirm-transaction-base.component'
describe('ConfirmTransactionBase Component', function () { describe('ConfirmTransactionBase Component', function () {
describe('getMethodName', function () { describe('getMethodName', function () {
it('should get correct method names', function () { it('should get correct method names', function () {
assert.equal(getMethodName(undefined), '') assert.strictEqual(getMethodName(undefined), '')
assert.equal(getMethodName({}), '') assert.strictEqual(getMethodName({}), '')
assert.equal(getMethodName('confirm'), 'confirm') assert.strictEqual(getMethodName('confirm'), 'confirm')
assert.equal(getMethodName('balanceOf'), 'balance Of') assert.strictEqual(getMethodName('balanceOf'), 'balance Of')
assert.equal( assert.strictEqual(
getMethodName('ethToTokenSwapInput'), getMethodName('ethToTokenSwapInput'),
'eth To Token Swap Input', 'eth To Token Swap Input',
) )

@ -27,18 +27,24 @@ describe('Create Account Page', function () {
it('clicks create account and routes to new-account path', function () { it('clicks create account and routes to new-account path', function () {
const createAccount = wrapper.find('.new-account__tabs__tab').at(0) const createAccount = wrapper.find('.new-account__tabs__tab').at(0)
createAccount.simulate('click') 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 () { it('clicks import account and routes to import new account path', function () {
const importAccount = wrapper.find('.new-account__tabs__tab').at(1) const importAccount = wrapper.find('.new-account__tabs__tab').at(1)
importAccount.simulate('click') 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 () { it('clicks connect HD Wallet and routes to connect new account path', function () {
const connectHdWallet = wrapper.find('.new-account__tabs__tab').at(2) const connectHdWallet = wrapper.find('.new-account__tabs__tab').at(2)
connectHdWallet.simulate('click') 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',
)
}) })
}) })

@ -20,7 +20,7 @@ describe('ImportWithSeedPhrase Component', function () {
onSubmit: sinon.spy(), onSubmit: sinon.spy(),
}) })
const textareaCount = root.find('.first-time-flow__textarea').length 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 () { describe('parseSeedPhrase', function () {
@ -31,7 +31,7 @@ describe('ImportWithSeedPhrase Component', function () {
const { parseSeedPhrase } = root.instance() 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 () { it('should handle a mixed-case seed phrase', function () {
@ -41,7 +41,7 @@ describe('ImportWithSeedPhrase Component', function () {
const { parseSeedPhrase } = root.instance() 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 () { it('should handle an upper-case seed phrase', function () {
@ -51,7 +51,7 @@ describe('ImportWithSeedPhrase Component', function () {
const { parseSeedPhrase } = root.instance() 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 () { it('should trim extraneous whitespace from the given seed phrase', function () {
@ -61,7 +61,10 @@ describe('ImportWithSeedPhrase Component', function () {
const { parseSeedPhrase } = root.instance() 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 () { 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() const { parseSeedPhrase } = root.instance()
assert.deepEqual(parseSeedPhrase(' '), '') assert.deepStrictEqual(parseSeedPhrase(' '), '')
}) })
it('should return an empty string when given a string with only symbols', function () { 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() const { parseSeedPhrase } = root.instance()
assert.deepEqual(parseSeedPhrase('$'), '') assert.deepStrictEqual(parseSeedPhrase('$'), '')
}) })
it('should return an empty string for both null and undefined', function () { it('should return an empty string for both null and undefined', function () {
@ -91,8 +94,8 @@ describe('ImportWithSeedPhrase Component', function () {
const { parseSeedPhrase } = root.instance() const { parseSeedPhrase } = root.instance()
assert.deepEqual(parseSeedPhrase(undefined), '') assert.deepStrictEqual(parseSeedPhrase(undefined), '')
assert.deepEqual(parseSeedPhrase(null), '') assert.deepStrictEqual(parseSeedPhrase(null), '')
}) })
}) })
}) })

@ -20,7 +20,7 @@ describe('End of Flow Screen', function () {
}) })
it('renders', 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) { it('should navigate to the default route on click', function (done) {

@ -21,7 +21,7 @@ describe('FirstTimeFlowSwitch', function () {
const wrapper = mountWithRouter( const wrapper = mountWithRouter(
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('Lifecycle') .find('Lifecycle')
.find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length, .find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length,
@ -37,7 +37,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper.find('Lifecycle').find({ to: { pathname: DEFAULT_ROUTE } }) wrapper.find('Lifecycle').find({ to: { pathname: DEFAULT_ROUTE } })
.length, .length,
1, 1,
@ -53,7 +53,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('Lifecycle') .find('Lifecycle')
.find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length, .find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length,
@ -70,7 +70,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('Lifecycle') .find('Lifecycle')
.find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length, .find({ to: { pathname: INITIALIZE_END_OF_FLOW_ROUTE } }).length,
@ -89,7 +89,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper.find('Lifecycle').find({ to: { pathname: LOCK_ROUTE } }).length, wrapper.find('Lifecycle').find({ to: { pathname: LOCK_ROUTE } }).length,
1, 1,
) )
@ -107,7 +107,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('Lifecycle') .find('Lifecycle')
.find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length, .find({ to: { pathname: INITIALIZE_WELCOME_ROUTE } }).length,
@ -127,7 +127,7 @@ describe('FirstTimeFlowSwitch', function () {
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('Lifecycle') .find('Lifecycle')
.find({ to: { pathname: INITIALIZE_UNLOCK_ROUTE } }).length, .find({ to: { pathname: INITIALIZE_UNLOCK_ROUTE } }).length,

@ -30,18 +30,18 @@ describe('Reveal Seed Phrase', function () {
it('seed phrase', function () { it('seed phrase', function () {
const seedPhrase = wrapper.find('.reveal-seed-phrase__secret-words--hidden') const seedPhrase = wrapper.find('.reveal-seed-phrase__secret-words--hidden')
assert.equal(seedPhrase.length, 1) assert.strictEqual(seedPhrase.length, 1)
assert.equal(seedPhrase.text(), TEST_SEED) assert.strictEqual(seedPhrase.text(), TEST_SEED)
}) })
it('clicks to reveal', function () { it('clicks to reveal', function () {
const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker') const reveal = wrapper.find('.reveal-seed-phrase__secret-blocker')
assert.equal(wrapper.state().isShowingSeedPhrase, false) assert.strictEqual(wrapper.state().isShowingSeedPhrase, false)
reveal.simulate('click') reveal.simulate('click')
assert.equal(wrapper.state().isShowingSeedPhrase, true) assert.strictEqual(wrapper.state().isShowingSeedPhrase, true)
const showSeed = wrapper.find('.reveal-seed-phrase__secret-words') const showSeed = wrapper.find('.reveal-seed-phrase__secret-words')
assert.equal(showSeed.length, 1) assert.strictEqual(showSeed.length, 1)
}) })
}) })

@ -19,7 +19,7 @@ describe('ConfirmSeedPhrase Component', function () {
seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬', seedPhrase: '鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬',
}) })
assert.equal( assert.strictEqual(
root.find('.confirm-seed-phrase__seed-word--sorted').length, root.find('.confirm-seed-phrase__seed-word--sorted').length,
12, 12,
'should render 12 seed phrases', 'should render 12 seed phrases',
@ -46,7 +46,7 @@ describe('ConfirmSeedPhrase Component', function () {
seeds.at(1).simulate('click') seeds.at(1).simulate('click')
seeds.at(2).simulate('click') seeds.at(2).simulate('click')
assert.deepEqual( assert.deepStrictEqual(
root.state().selectedSeedIndices, root.state().selectedSeedIndices,
[0, 1, 2], [0, 1, 2],
'should add seed phrase to selected on click', 'should add seed phrase to selected on click',
@ -57,7 +57,7 @@ describe('ConfirmSeedPhrase Component', function () {
root.update() root.update()
root.state() root.state()
root.find('.confirm-seed-phrase__seed-word--sorted').at(1).simulate('click') root.find('.confirm-seed-phrase__seed-word--sorted').at(1).simulate('click')
assert.deepEqual( assert.deepStrictEqual(
root.state().selectedSeedIndices, root.state().selectedSeedIndices,
[0, 2], [0, 2],
'should remove seed phrase from selected when click again', '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', '.confirm-seed-phrase__selected-seed-words__pending-seed',
) )
assert.equal(pendingSeeds.at(0).props().seedIndex, 2) assert.strictEqual(pendingSeeds.at(0).props().seedIndex, 2)
assert.equal(pendingSeeds.at(1).props().seedIndex, 0) assert.strictEqual(pendingSeeds.at(1).props().seedIndex, 0)
assert.equal(pendingSeeds.at(2).props().seedIndex, 1) assert.strictEqual(pendingSeeds.at(2).props().seedIndex, 1)
}) })
it('should insert seed in place on drop', function () { it('should insert seed in place on drop', function () {
@ -126,8 +126,8 @@ describe('ConfirmSeedPhrase Component', function () {
root.update() root.update()
assert.deepEqual(root.state().selectedSeedIndices, [2, 0, 1]) assert.deepStrictEqual(root.state().selectedSeedIndices, [2, 0, 1])
assert.deepEqual(root.state().pendingSeedIndices, [2, 0, 1]) assert.deepStrictEqual(root.state().pendingSeedIndices, [2, 0, 1])
}) })
it('should submit correctly', async function () { it('should submit correctly', async function () {
@ -174,7 +174,7 @@ describe('ConfirmSeedPhrase Component', function () {
await new Promise((resolve) => setTimeout(resolve, 100)) await new Promise((resolve) => setTimeout(resolve, 100))
assert.deepEqual(metricsEventSpy.args[0][0], { assert.deepStrictEqual(metricsEventSpy.args[0][0], {
eventOpts: { eventOpts: {
category: 'Onboarding', category: 'Onboarding',
action: 'Seed Phrase Setup', action: 'Seed Phrase Setup',
@ -182,6 +182,6 @@ describe('ConfirmSeedPhrase Component', function () {
}, },
}) })
assert(initialize3BoxSpy.calledOnce) assert(initialize3BoxSpy.calledOnce)
assert.equal(pushSpy.args[0][0], '/initialize/end-of-flow') assert.strictEqual(pushSpy.args[0][0], '/initialize/end-of-flow')
}) })
}) })

@ -31,7 +31,7 @@ describe('Selection Action', function () {
importWalletButton.simulate('click') importWalletButton.simulate('click')
assert(props.setFirstTimeFlowType.calledOnce) 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) assert(props.history.push.calledOnce)
}) })
@ -42,7 +42,7 @@ describe('Selection Action', function () {
createWalletButton.simulate('click') createWalletButton.simulate('click')
assert(props.setFirstTimeFlowType.calledOnce) 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) assert(props.history.push.calledOnce)
}) })
}) })

@ -32,7 +32,7 @@ describe('Welcome', function () {
'.btn-primary.first-time-flow__button', '.btn-primary.first-time-flow__button',
) )
getStartedButton.simulate('click') getStartedButton.simulate('click')
assert.equal( assert.strictEqual(
props.history.push.getCall(0).args[0], props.history.push.getCall(0).args[0],
'/initialize/select-action', '/initialize/select-action',
) )
@ -56,7 +56,7 @@ describe('Welcome', function () {
'.btn-primary.first-time-flow__button', '.btn-primary.first-time-flow__button',
) )
getStartedButton.simulate('click') getStartedButton.simulate('click')
assert.equal( assert.strictEqual(
props.history.push.getCall(0).args[0], props.history.push.getCall(0).args[0],
'/initialize/create-password', '/initialize/create-password',
) )

@ -15,7 +15,7 @@ describe('Lock', function () {
mountWithRouter(<Lock.WrappedComponent {...props} />) mountWithRouter(<Lock.WrappedComponent {...props} />)
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) { it('locks and pushes history with default route when isUnlocked true', function (done) {
@ -33,7 +33,7 @@ describe('Lock', function () {
assert(props.lockMetamask.calledOnce) assert(props.lockMetamask.calledOnce)
setImmediate(() => { setImmediate(() => {
assert.equal(props.history.push.getCall(0).args[0], '/') assert.strictEqual(props.history.push.getCall(0).args[0], '/')
done() done()
}) })
}) })

@ -68,25 +68,28 @@ describe('AddRecipient Component', function () {
describe('selectRecipient', function () { describe('selectRecipient', function () {
it('should call updateSendTo', function () { it('should call updateSendTo', function () {
assert.equal(propsMethodSpies.updateSendTo.callCount, 0) assert.strictEqual(propsMethodSpies.updateSendTo.callCount, 0)
instance.selectRecipient('mockTo2', 'mockNickname') instance.selectRecipient('mockTo2', 'mockNickname')
assert.equal(propsMethodSpies.updateSendTo.callCount, 1) assert.strictEqual(propsMethodSpies.updateSendTo.callCount, 1)
assert.deepEqual(propsMethodSpies.updateSendTo.getCall(0).args, [ assert.deepStrictEqual(propsMethodSpies.updateSendTo.getCall(0).args, [
'mockTo2', 'mockTo2',
'mockNickname', 'mockNickname',
]) ])
}) })
it('should call updateGas if there is no to error', function () { 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) instance.selectRecipient(false)
assert.equal(propsMethodSpies.updateGas.callCount, 1) assert.strictEqual(propsMethodSpies.updateGas.callCount, 1)
}) })
}) })
describe('render', function () { describe('render', function () {
it('should render a component', 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 () { it('should render no content if there are no recents, transfers, and contacts', function () {
@ -95,11 +98,11 @@ describe('AddRecipient Component', function () {
addressBook: [], addressBook: [],
}) })
assert.equal( assert.strictEqual(
wrapper.find('.send__select-recipient-wrapper__list__link').length, wrapper.find('.send__select-recipient-wrapper__list__link').length,
0, 0,
) )
assert.equal( assert.strictEqual(
wrapper.find('.send__select-recipient-wrapper__group').length, wrapper.find('.send__select-recipient-wrapper__group').length,
0, 0,
) )
@ -118,10 +121,10 @@ describe('AddRecipient Component', function () {
const xferLink = wrapper.find( const xferLink = wrapper.find(
'.send__select-recipient-wrapper__list__link', '.send__select-recipient-wrapper__list__link',
) )
assert.equal(xferLink.length, 1) assert.strictEqual(xferLink.length, 1)
const groups = wrapper.find('RecipientGroup') const groups = wrapper.find('RecipientGroup')
assert.equal( assert.strictEqual(
groups.shallow().find('.send__select-recipient-wrapper__group').length, groups.shallow().find('.send__select-recipient-wrapper__group').length,
1, 1,
) )
@ -138,7 +141,7 @@ describe('AddRecipient Component', function () {
const contactList = wrapper.find('ContactList') const contactList = wrapper.find('ContactList')
assert.equal(contactList.length, 1) assert.strictEqual(contactList.length, 1)
}) })
it('should render contacts', function () { it('should render contacts', function () {
@ -154,12 +157,12 @@ describe('AddRecipient Component', function () {
const xferLink = wrapper.find( const xferLink = wrapper.find(
'.send__select-recipient-wrapper__list__link', '.send__select-recipient-wrapper__list__link',
) )
assert.equal(xferLink.length, 0) assert.strictEqual(xferLink.length, 0)
const groups = wrapper.find('ContactList') 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, groups.find('.send__select-recipient-wrapper__group-item').length,
0, 0,
) )
@ -175,9 +178,9 @@ describe('AddRecipient Component', function () {
const dialog = wrapper.find(Dialog) const dialog = wrapper.find(Dialog)
assert.equal(dialog.props().type, 'error') assert.strictEqual(dialog.props().type, 'error')
assert.equal(dialog.props().children, 'bad_t') assert.strictEqual(dialog.props().children, 'bad_t')
assert.equal(dialog.length, 1) assert.strictEqual(dialog.length, 1)
}) })
it('should render error when query has ens does not resolve', function () { 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) const dialog = wrapper.find(Dialog)
assert.equal(dialog.props().type, 'error') assert.strictEqual(dialog.props().type, 'error')
assert.equal(dialog.props().children, 'very bad') assert.strictEqual(dialog.props().children, 'very bad')
assert.equal(dialog.length, 1) assert.strictEqual(dialog.length, 1)
}) })
it('should not render error when ens resolved', function () { it('should not render error when ens resolved', function () {
@ -205,7 +208,7 @@ describe('AddRecipient Component', function () {
const dialog = wrapper.find(Dialog) 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 () { it('should not render error when query has results', function () {
@ -220,7 +223,7 @@ describe('AddRecipient Component', function () {
const dialog = wrapper.find(Dialog) const dialog = wrapper.find(Dialog)
assert.equal(dialog.length, 0) assert.strictEqual(dialog.length, 0)
}) })
}) })
}) })

@ -33,7 +33,7 @@ proxyquire('../add-recipient.container.js', {
describe('add-recipient container', function () { describe('add-recipient container', function () {
describe('mapStateToProps()', function () { describe('mapStateToProps()', function () {
it('should map the correct properties to props', function () { it('should map the correct properties to props', function () {
assert.deepEqual(mapStateToProps('mockState'), { assert.deepStrictEqual(mapStateToProps('mockState'), {
addressBook: [{ name: 'mockAddressBook:mockState' }], addressBook: [{ name: 'mockAddressBook:mockState' }],
contacts: [{ name: 'mockAddressBook:mockState' }], contacts: [{ name: 'mockAddressBook:mockState' }],
ensResolution: 'mockSendEnsResolution:mockState', ensResolution: 'mockSendEnsResolution:mockState',
@ -57,7 +57,7 @@ describe('add-recipient container', function () {
mapDispatchToPropsObject.updateSendTo('mockTo', 'mockNickname') mapDispatchToPropsObject.updateSendTo('mockTo', 'mockNickname')
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert(actionSpies.updateSendTo.calledOnce) assert(actionSpies.updateSendTo.calledOnce)
assert.deepEqual(actionSpies.updateSendTo.getCall(0).args, [ assert.deepStrictEqual(actionSpies.updateSendTo.getCall(0).args, [
'mockTo', 'mockTo',
'mockNickname', 'mockNickname',
]) ])

@ -24,25 +24,25 @@ const { getToErrorObject, getToWarningObject } = toRowUtils
describe('add-recipient utils', function () { describe('add-recipient utils', function () {
describe('getToErrorObject()', function () { describe('getToErrorObject()', function () {
it('should return a required error if "to" is falsy', function () { it('should return a required error if "to" is falsy', function () {
assert.deepEqual(getToErrorObject(null), { assert.deepStrictEqual(getToErrorObject(null), {
to: REQUIRED_ERROR, to: REQUIRED_ERROR,
}) })
}) })
it('should return null if "to" is falsy and hexData is truthy', function () { 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, to: null,
}) })
}) })
it('should return an invalid recipient error if "to" is truthy but invalid', function () { 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, to: INVALID_RECIPIENT_ADDRESS_ERROR,
}) })
}) })
it('should return null if "to" is truthy and valid', function () { it('should return null if "to" is truthy and valid', function () {
assert.deepEqual(getToErrorObject('0xabc123'), { assert.deepStrictEqual(getToErrorObject('0xabc123'), {
to: null, to: null,
}) })
}) })
@ -50,7 +50,7 @@ describe('add-recipient utils', function () {
describe('getToWarningObject()', function () { describe('getToWarningObject()', function () {
it('should return a known address recipient error if "to" is a token address', function () { it('should return a known address recipient error if "to" is a token address', function () {
assert.deepEqual( assert.deepStrictEqual(
getToWarningObject('0xabc123', [{ address: '0xabc123' }], { getToWarningObject('0xabc123', [{ address: '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 () { it('should null if "to" is a token address but sendToken is falsy', function () {
assert.deepEqual( assert.deepStrictEqual(
getToWarningObject('0xabc123', [{ address: '0xabc123' }]), getToWarningObject('0xabc123', [{ address: '0xabc123' }]),
{ {
to: null, 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 () { it('should return a known address recipient error if "to" is part of contract metadata', function () {
assert.deepEqual( assert.deepStrictEqual(
getToWarningObject( getToWarningObject(
'0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
[{ address: '0xabc123' }], [{ 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 () { it('should null if "to" is part of contract metadata but sendToken is falsy', function () {
assert.deepEqual( assert.deepStrictEqual(
getToWarningObject( getToWarningObject(
'0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
[{ address: '0xabc123' }], [{ address: '0xabc123' }],

@ -52,10 +52,10 @@ describe('AmountMaxButton Component', function () {
describe('setMaxAmount', function () { describe('setMaxAmount', function () {
it('should call setAmountToMax with the correct params', function () { it('should call setAmountToMax with the correct params', function () {
assert.equal(propsMethodSpies.setAmountToMax.callCount, 0) assert.strictEqual(propsMethodSpies.setAmountToMax.callCount, 0)
instance.setMaxAmount() instance.setMaxAmount()
assert.equal(propsMethodSpies.setAmountToMax.callCount, 1) assert.strictEqual(propsMethodSpies.setAmountToMax.callCount, 1)
assert.deepEqual(propsMethodSpies.setAmountToMax.getCall(0).args, [ assert.deepStrictEqual(propsMethodSpies.setAmountToMax.getCall(0).args, [
{ {
balance: 'mockBalance', balance: 'mockBalance',
gasTotal: 'mockGasTotal', gasTotal: 'mockGasTotal',
@ -74,17 +74,19 @@ describe('AmountMaxButton Component', function () {
it('should call setMaxModeTo and setMaxAmount when the checkbox is checked', function () { it('should call setMaxModeTo and setMaxAmount when the checkbox is checked', function () {
const { onClick } = wrapper.find('.send-v2__amount-max').props() const { onClick } = wrapper.find('.send-v2__amount-max').props()
assert.equal(AmountMaxButton.prototype.setMaxAmount.callCount, 0) assert.strictEqual(AmountMaxButton.prototype.setMaxAmount.callCount, 0)
assert.equal(propsMethodSpies.setMaxModeTo.callCount, 0) assert.strictEqual(propsMethodSpies.setMaxModeTo.callCount, 0)
onClick(MOCK_EVENT) onClick(MOCK_EVENT)
assert.equal(AmountMaxButton.prototype.setMaxAmount.callCount, 1) assert.strictEqual(AmountMaxButton.prototype.setMaxAmount.callCount, 1)
assert.equal(propsMethodSpies.setMaxModeTo.callCount, 1) assert.strictEqual(propsMethodSpies.setMaxModeTo.callCount, 1)
assert.deepEqual(propsMethodSpies.setMaxModeTo.getCall(0).args, [true]) assert.deepStrictEqual(propsMethodSpies.setMaxModeTo.getCall(0).args, [
true,
])
}) })
it('should render the expected text when maxModeOn is false', function () { it('should render the expected text when maxModeOn is false', function () {
wrapper.setProps({ maxModeOn: false }) 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')
}) })
}) })
}) })

@ -39,7 +39,7 @@ proxyquire('../amount-max-button.container.js', {
describe('amount-max-button container', function () { describe('amount-max-button container', function () {
describe('mapStateToProps()', function () { describe('mapStateToProps()', function () {
it('should map the correct properties to props', function () { it('should map the correct properties to props', function () {
assert.deepEqual(mapStateToProps('mockState'), { assert.deepStrictEqual(mapStateToProps('mockState'), {
balance: 'mockBalance:mockState', balance: 'mockBalance:mockState',
buttonDataLoading: 'mockButtonDataLoading:mockState', buttonDataLoading: 'mockButtonDataLoading:mockState',
gasTotal: 'mockGasTotal:mockState', gasTotal: 'mockGasTotal:mockState',
@ -64,11 +64,14 @@ describe('amount-max-button container', function () {
mapDispatchToPropsObject.setAmountToMax({ val: 11, foo: 'bar' }) mapDispatchToPropsObject.setAmountToMax({ val: 11, foo: 'bar' })
assert(dispatchSpy.calledTwice) assert(dispatchSpy.calledTwice)
assert(duckActionSpies.updateSendErrors.calledOnce) assert(duckActionSpies.updateSendErrors.calledOnce)
assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { assert.deepStrictEqual(
duckActionSpies.updateSendErrors.getCall(0).args[0],
{
amount: null, amount: null,
}) },
)
assert(actionSpies.updateSendAmount.calledOnce) 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 () { it('should dispatch an action', function () {
mapDispatchToPropsObject.setMaxModeTo('mockVal') mapDispatchToPropsObject.setMaxModeTo('mockVal')
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert.equal(actionSpies.setMaxModeTo.getCall(0).args[0], 'mockVal') assert.strictEqual(
actionSpies.setMaxModeTo.getCall(0).args[0],
'mockVal',
)
}) })
}) })
}) })

@ -4,7 +4,7 @@ import { calcMaxAmount } from '../amount-max-button.utils'
describe('amount-max-button utils', function () { describe('amount-max-button utils', function () {
describe('calcMaxAmount()', function () { describe('calcMaxAmount()', function () {
it('should calculate the correct amount when no sendToken defined', function () { it('should calculate the correct amount when no sendToken defined', function () {
assert.deepEqual( assert.deepStrictEqual(
calcMaxAmount({ calcMaxAmount({
balance: 'ffffff', balance: 'ffffff',
gasTotal: 'ff', gasTotal: 'ff',
@ -15,7 +15,7 @@ describe('amount-max-button utils', function () {
}) })
it('should calculate the correct amount when a sendToken is defined', function () { it('should calculate the correct amount when a sendToken is defined', function () {
assert.deepEqual( assert.deepStrictEqual(
calcMaxAmount({ calcMaxAmount({
sendToken: { sendToken: {
decimals: 10, decimals: 10,

@ -16,7 +16,7 @@ describe('SendAmountRow Component', function () {
propsMethodSpies: { updateSendAmountError }, propsMethodSpies: { updateSendAmountError },
} = shallowRenderSendAmountRow() } = shallowRenderSendAmountRow()
assert.equal(updateSendAmountError.callCount, 0) assert.strictEqual(updateSendAmountError.callCount, 0)
instance.validateAmount('someAmount') instance.validateAmount('someAmount')
@ -39,7 +39,7 @@ describe('SendAmountRow Component', function () {
propsMethodSpies: { updateGasFeeError }, propsMethodSpies: { updateGasFeeError },
} = shallowRenderSendAmountRow() } = shallowRenderSendAmountRow()
assert.equal(updateGasFeeError.callCount, 0) assert.strictEqual(updateGasFeeError.callCount, 0)
instance.validateAmount('someAmount') instance.validateAmount('someAmount')
@ -64,11 +64,11 @@ describe('SendAmountRow Component', function () {
wrapper.setProps({ sendToken: null }) wrapper.setProps({ sendToken: null })
assert.equal(updateGasFeeError.callCount, 0) assert.strictEqual(updateGasFeeError.callCount, 0)
instance.validateAmount('someAmount') instance.validateAmount('someAmount')
assert.equal(updateGasFeeError.callCount, 0) assert.strictEqual(updateGasFeeError.callCount, 0)
}) })
}) })
@ -79,7 +79,7 @@ describe('SendAmountRow Component', function () {
propsMethodSpies: { setMaxModeTo }, propsMethodSpies: { setMaxModeTo },
} = shallowRenderSendAmountRow() } = shallowRenderSendAmountRow()
assert.equal(setMaxModeTo.callCount, 0) assert.strictEqual(setMaxModeTo.callCount, 0)
instance.updateAmount('someAmount') instance.updateAmount('someAmount')
@ -92,7 +92,7 @@ describe('SendAmountRow Component', function () {
propsMethodSpies: { updateSendAmount }, propsMethodSpies: { updateSendAmount },
} = shallowRenderSendAmountRow() } = shallowRenderSendAmountRow()
assert.equal(updateSendAmount.callCount, 0) assert.strictEqual(updateSendAmount.callCount, 0)
instance.updateAmount('someAmount') instance.updateAmount('someAmount')
@ -104,7 +104,7 @@ describe('SendAmountRow Component', function () {
it('should render a SendRowWrapper component', function () { it('should render a SendRowWrapper component', function () {
const { wrapper } = shallowRenderSendAmountRow() 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 () { it('should pass the correct props to SendRowWrapper', function () {
@ -113,9 +113,9 @@ describe('SendAmountRow Component', function () {
.find(SendRowWrapper) .find(SendRowWrapper)
.props() .props()
assert.equal(errorType, 'amount') assert.strictEqual(errorType, 'amount')
assert.equal(label, 'amount_t:') assert.strictEqual(label, 'amount_t:')
assert.equal(showError, false) assert.strictEqual(showError, false)
}) })
it('should render an AmountMaxButton as the first child of the SendRowWrapper', function () { it('should render an AmountMaxButton as the first child of the SendRowWrapper', function () {
@ -142,11 +142,11 @@ describe('SendAmountRow Component', function () {
.childAt(1) .childAt(1)
.props() .props()
assert.equal(error, false) assert.strictEqual(error, false)
assert.equal(value, 'mockAmount') assert.strictEqual(value, 'mockAmount')
assert.equal(updateGas.callCount, 0) assert.strictEqual(updateGas.callCount, 0)
assert.equal(updateAmount.callCount, 0) assert.strictEqual(updateAmount.callCount, 0)
assert.equal(validateAmount.callCount, 0) assert.strictEqual(validateAmount.callCount, 0)
onChange('mockNewAmount') onChange('mockNewAmount')

@ -50,7 +50,10 @@ describe('send-amount-row container', function () {
mapDispatchToPropsObject.setMaxModeTo('mockBool') mapDispatchToPropsObject.setMaxModeTo('mockBool')
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert(actionSpies.setMaxModeTo.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') mapDispatchToPropsObject.updateSendAmount('mockAmount')
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert(actionSpies.updateSendAmount.calledOnce) assert(actionSpies.updateSendAmount.calledOnce)
assert.equal( assert.strictEqual(
actionSpies.updateSendAmount.getCall(0).args[0], actionSpies.updateSendAmount.getCall(0).args[0],
'mockAmount', 'mockAmount',
) )
@ -71,10 +74,13 @@ describe('send-amount-row container', function () {
mapDispatchToPropsObject.updateGasFeeError({ some: 'data' }) mapDispatchToPropsObject.updateGasFeeError({ some: 'data' })
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert(duckActionSpies.updateSendErrors.calledOnce) assert(duckActionSpies.updateSendErrors.calledOnce)
assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { assert.deepStrictEqual(
duckActionSpies.updateSendErrors.getCall(0).args[0],
{
some: 'data', some: 'data',
mockGasFeeErrorChange: true, mockGasFeeErrorChange: true,
}) },
)
}) })
}) })
@ -83,10 +89,13 @@ describe('send-amount-row container', function () {
mapDispatchToPropsObject.updateSendAmountError({ some: 'data' }) mapDispatchToPropsObject.updateSendAmountError({ some: 'data' })
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert(duckActionSpies.updateSendErrors.calledOnce) assert(duckActionSpies.updateSendErrors.calledOnce)
assert.deepEqual(duckActionSpies.updateSendErrors.getCall(0).args[0], { assert.deepStrictEqual(
duckActionSpies.updateSendErrors.getCall(0).args[0],
{
some: 'data', some: 'data',
mockChange: true, mockChange: true,
}) },
)
}) })
}) })
}) })

@ -33,7 +33,7 @@ describe('GasFeeDisplay Component', function () {
}) })
it('should render a CurrencyDisplay 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 () { it('should render the CurrencyDisplay with the correct props', function () {
@ -41,20 +41,20 @@ describe('GasFeeDisplay Component', function () {
.find(UserPreferencedCurrencyDisplay) .find(UserPreferencedCurrencyDisplay)
.at(0) .at(0)
.props() .props()
assert.equal(type, 'PRIMARY') assert.strictEqual(type, 'PRIMARY')
assert.equal(value, 'mockGasTotal') assert.strictEqual(value, 'mockGasTotal')
}) })
it('should render the reset button with the correct props', function () { it('should render the reset button with the correct props', function () {
const { onClick, className } = wrapper.find('button').props() const { onClick, className } = wrapper.find('button').props()
assert.equal(className, 'gas-fee-reset') assert.strictEqual(className, 'gas-fee-reset')
assert.equal(propsMethodSpies.onReset.callCount, 0) assert.strictEqual(propsMethodSpies.onReset.callCount, 0)
onClick() onClick()
assert.equal(propsMethodSpies.onReset.callCount, 1) assert.strictEqual(propsMethodSpies.onReset.callCount, 1)
}) })
it('should render the reset button with the correct text', function () { 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')
}) })
}) })
}) })

@ -43,8 +43,8 @@ describe('SendGasRow Component', function () {
}) })
it('should render a SendRowWrapper component', function () { it('should render a SendRowWrapper component', function () {
assert.equal(wrapper.name(), 'Fragment') assert.strictEqual(wrapper.name(), 'Fragment')
assert.equal(wrapper.at(0).find(SendRowWrapper).length, 1) assert.strictEqual(wrapper.at(0).find(SendRowWrapper).length, 1)
}) })
it('should pass the correct props to SendRowWrapper', function () { it('should pass the correct props to SendRowWrapper', function () {
@ -53,9 +53,9 @@ describe('SendGasRow Component', function () {
.first() .first()
.props() .props()
assert.equal(label, 'transactionFee_t:') assert.strictEqual(label, 'transactionFee_t:')
assert.equal(showError, true) assert.strictEqual(showError, true)
assert.equal(errorType, 'gasFee') assert.strictEqual(errorType, 'gasFee')
}) })
it('should render a GasFeeDisplay as a child of the SendRowWrapper', function () { it('should render a GasFeeDisplay as a child of the SendRowWrapper', function () {
@ -68,27 +68,27 @@ describe('SendGasRow Component', function () {
.first() .first()
.childAt(0) .childAt(0)
.props() .props()
assert.equal(gasLoadingError, false) assert.strictEqual(gasLoadingError, false)
assert.equal(gasTotal, 'mockGasTotal') assert.strictEqual(gasTotal, 'mockGasTotal')
assert.equal(propsMethodSpies.resetGasButtons.callCount, 0) assert.strictEqual(propsMethodSpies.resetGasButtons.callCount, 0)
onReset() onReset()
assert.equal(propsMethodSpies.resetGasButtons.callCount, 1) assert.strictEqual(propsMethodSpies.resetGasButtons.callCount, 1)
}) })
it('should render the GasPriceButtonGroup if gasButtonGroupShown is true', function () { it('should render the GasPriceButtonGroup if gasButtonGroupShown is true', function () {
wrapper.setProps({ gasButtonGroupShown: true }) wrapper.setProps({ gasButtonGroupShown: true })
const rendered = wrapper.find(SendRowWrapper).first().childAt(0) 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) const gasPriceButtonGroup = rendered.childAt(0)
assert(gasPriceButtonGroup.is(GasPriceButtonGroup)) assert(gasPriceButtonGroup.is(GasPriceButtonGroup))
assert(gasPriceButtonGroup.hasClass('gas-price-button-group--small')) assert(gasPriceButtonGroup.hasClass('gas-price-button-group--small'))
assert.equal(gasPriceButtonGroup.props().showCheck, false) assert.strictEqual(gasPriceButtonGroup.props().showCheck, false)
assert.equal( assert.strictEqual(
gasPriceButtonGroup.props().someGasPriceButtonGroupProp, gasPriceButtonGroup.props().someGasPriceButtonGroupProp,
'foo', 'foo',
) )
assert.equal( assert.strictEqual(
gasPriceButtonGroup.props().anotherGasPriceButtonGroupProp, gasPriceButtonGroup.props().anotherGasPriceButtonGroupProp,
'bar', 'bar',
) )
@ -97,14 +97,14 @@ describe('SendGasRow Component', function () {
it('should render an advanced options button if gasButtonGroupShown is true', function () { it('should render an advanced options button if gasButtonGroupShown is true', function () {
wrapper.setProps({ gasButtonGroupShown: true }) wrapper.setProps({ gasButtonGroupShown: true })
const rendered = wrapper.find(SendRowWrapper).last() const rendered = wrapper.find(SendRowWrapper).last()
assert.equal(wrapper.children().length, 2) assert.strictEqual(wrapper.children().length, 2)
const advancedOptionsButton = rendered.childAt(0) 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() advancedOptionsButton.props().onClick()
assert.equal(propsMethodSpies.showCustomizeGasModal.callCount, 1) assert.strictEqual(propsMethodSpies.showCustomizeGasModal.callCount, 1)
}) })
}) })
}) })

@ -18,16 +18,16 @@ describe('SendRowErrorMessage Component', function () {
}) })
it('should render null if the passed errors do not contain an error of errorType', 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.strictEqual(wrapper.find('.send-v2__error').length, 0)
assert.equal(wrapper.html(), null) assert.strictEqual(wrapper.html(), null)
}) })
it('should render an error message if the passed errors contain an error of errorType', function () { it('should render an error message if the passed errors contain an error of errorType', function () {
wrapper.setProps({ wrapper.setProps({
errors: { error1: 'abc', error2: 'def', error3: 'xyz' }, errors: { error1: 'abc', error2: 'def', error3: 'xyz' },
}) })
assert.equal(wrapper.find('.send-v2__error').length, 1) assert.strictEqual(wrapper.find('.send-v2__error').length, 1)
assert.equal(wrapper.find('.send-v2__error').text(), 'xyz_t') assert.strictEqual(wrapper.find('.send-v2__error').text(), 'xyz_t')
}) })
}) })
}) })

@ -16,7 +16,7 @@ proxyquire('../send-row-error-message.container.js', {
describe('send-row-error-message container', function () { describe('send-row-error-message container', function () {
describe('mapStateToProps()', function () { describe('mapStateToProps()', function () {
it('should map the correct properties to props', function () { it('should map the correct properties to props', function () {
assert.deepEqual( assert.deepStrictEqual(
mapStateToProps('mockState', { errorType: 'someType' }), mapStateToProps('mockState', { errorType: 'someType' }),
{ {
errors: 'mockErrors:mockState', errors: 'mockErrors:mockState',

@ -22,22 +22,22 @@ describe('SendContent Component', function () {
}) })
it('should render a div with a send-v2__form-row class', 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 () { 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, wrapper.find('.send-v2__form-row > .send-v2__form-label').length,
1, 1,
) )
assert.equal( assert.strictEqual(
wrapper.find('.send-v2__form-row > .send-v2__form-field').length, wrapper.find('.send-v2__form-row > .send-v2__form-field').length,
1, 1,
) )
}) })
it('should render the label as a child of the send-v2__form-label', function () { it('should render the label as a child of the send-v2__form-label', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.send-v2__form-row > .send-v2__form-label') .find('.send-v2__form-row > .send-v2__form-label')
.childAt(0) .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 () { it('should render its first child as a child of the send-v2__form-field', function () {
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.send-v2__form-row > .send-v2__form-field') .find('.send-v2__form-row > .send-v2__form-field')
.childAt(0) .childAt(0)
@ -57,18 +57,18 @@ describe('SendContent Component', function () {
}) })
it('should not render a SendRowErrorMessage if showError is false', 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 () { it('should render a SendRowErrorMessage with and errorType props if showError is true', function () {
wrapper.setProps({ showError: true }) wrapper.setProps({ showError: true })
assert.equal(wrapper.find(SendRowErrorMessage).length, 1) assert.strictEqual(wrapper.find(SendRowErrorMessage).length, 1)
const expectedSendRowErrorMessage = wrapper const expectedSendRowErrorMessage = wrapper
.find('.send-v2__form-row > .send-v2__form-label') .find('.send-v2__form-row > .send-v2__form-label')
.childAt(1) .childAt(1)
assert(expectedSendRowErrorMessage.is(SendRowErrorMessage)) assert(expectedSendRowErrorMessage.is(SendRowErrorMessage))
assert.deepEqual(expectedSendRowErrorMessage.props(), { assert.deepStrictEqual(expectedSendRowErrorMessage.props(), {
errorType: 'mockErrorType', errorType: 'mockErrorType',
}) })
}) })
@ -84,7 +84,7 @@ describe('SendContent Component', function () {
<span>Mock Form Field</span> <span>Mock Form Field</span>
</SendRowWrapper>, </SendRowWrapper>,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.send-v2__form-row > .send-v2__form-field') .find('.send-v2__form-row > .send-v2__form-field')
.childAt(0) .childAt(0)
@ -104,7 +104,7 @@ describe('SendContent Component', function () {
<span>Mock Form Field</span> <span>Mock Form Field</span>
</SendRowWrapper>, </SendRowWrapper>,
) )
assert.equal( assert.strictEqual(
wrapper wrapper
.find('.send-v2__form-row > .send-v2__form-label') .find('.send-v2__form-row > .send-v2__form-label')
.childAt(1) .childAt(1)

@ -21,7 +21,7 @@ describe('SendContent Component', function () {
describe('render', function () { describe('render', function () {
it('should render a PageContainerContent component', 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 () { 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), PageContainerContentChild.childAt(3).is(SendGasRow),
'row[3] should be 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 () { 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), PageContainerContentChild.childAt(2).is(SendGasRow),
'row[3] should be 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 () { 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), PageContainerContentChild.childAt(2).is(SendGasRow),
'row[3] should be 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) const dialog = wrapper.find(Dialog).at(0)
assert.equal(dialog.props().type, 'warning') assert.strictEqual(dialog.props().type, 'warning')
assert.equal(dialog.props().children, 'watchout_t') assert.strictEqual(dialog.props().children, 'watchout_t')
assert.equal(dialog.length, 1) assert.strictEqual(dialog.length, 1)
}) })
}) })

@ -71,16 +71,16 @@ describe('SendFooter Component', function () {
describe('onCancel', function () { describe('onCancel', function () {
it('should call clearSend', function () { it('should call clearSend', function () {
assert.equal(propsMethodSpies.clearSend.callCount, 0) assert.strictEqual(propsMethodSpies.clearSend.callCount, 0)
wrapper.instance().onCancel() wrapper.instance().onCancel()
assert.equal(propsMethodSpies.clearSend.callCount, 1) assert.strictEqual(propsMethodSpies.clearSend.callCount, 1)
}) })
it('should call history.push', function () { it('should call history.push', function () {
assert.equal(historySpies.push.callCount, 0) assert.strictEqual(historySpies.push.callCount, 0)
wrapper.instance().onCancel() wrapper.instance().onCancel()
assert.equal(historySpies.push.callCount, 1) assert.strictEqual(historySpies.push.callCount, 1)
assert.equal( assert.strictEqual(
historySpies.push.getCall(0).args[0], historySpies.push.getCall(0).args[0],
'mostRecentOverviewPage', 'mostRecentOverviewPage',
) )
@ -133,7 +133,7 @@ describe('SendFooter Component', function () {
Object.entries(config).forEach(([description, obj]) => { Object.entries(config).forEach(([description, obj]) => {
it(description, function () { it(description, function () {
wrapper.setProps(obj) wrapper.setProps(obj)
assert.equal( assert.strictEqual(
wrapper.instance().formShouldBeDisabled(), wrapper.instance().formShouldBeDisabled(),
obj.expectedResult, obj.expectedResult,
) )
@ -145,16 +145,16 @@ describe('SendFooter Component', function () {
it('should call addToAddressBookIfNew with the correct params', function () { it('should call addToAddressBookIfNew with the correct params', function () {
wrapper.instance().onSubmit(MOCK_EVENT) wrapper.instance().onSubmit(MOCK_EVENT)
assert(propsMethodSpies.addToAddressBookIfNew.calledOnce) assert(propsMethodSpies.addToAddressBookIfNew.calledOnce)
assert.deepEqual(propsMethodSpies.addToAddressBookIfNew.getCall(0).args, [ assert.deepStrictEqual(
'mockTo', propsMethodSpies.addToAddressBookIfNew.getCall(0).args,
['mockAccount'], ['mockTo', ['mockAccount']],
]) )
}) })
it('should call props.update if editingTransactionId is truthy', async function () { it('should call props.update if editingTransactionId is truthy', async function () {
await wrapper.instance().onSubmit(MOCK_EVENT) await wrapper.instance().onSubmit(MOCK_EVENT)
assert(propsMethodSpies.update.calledOnce) assert(propsMethodSpies.update.calledOnce)
assert.deepEqual(propsMethodSpies.update.getCall(0).args[0], { assert.deepStrictEqual(propsMethodSpies.update.getCall(0).args[0], {
data: undefined, data: undefined,
amount: 'mockAmount', amount: 'mockAmount',
editingTransactionId: 'mockEditingTransactionId', editingTransactionId: 'mockEditingTransactionId',
@ -168,14 +168,14 @@ describe('SendFooter Component', function () {
}) })
it('should not call props.sign if editingTransactionId is truthy', 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 () { it('should call props.sign if editingTransactionId is falsy', async function () {
wrapper.setProps({ editingTransactionId: null }) wrapper.setProps({ editingTransactionId: null })
await wrapper.instance().onSubmit(MOCK_EVENT) await wrapper.instance().onSubmit(MOCK_EVENT)
assert(propsMethodSpies.sign.calledOnce) assert(propsMethodSpies.sign.calledOnce)
assert.deepEqual(propsMethodSpies.sign.getCall(0).args[0], { assert.deepStrictEqual(propsMethodSpies.sign.getCall(0).args[0], {
data: undefined, data: undefined,
amount: 'mockAmount', amount: 'mockAmount',
from: 'mockAddress', from: 'mockAddress',
@ -187,13 +187,13 @@ describe('SendFooter Component', function () {
}) })
it('should not call props.update if editingTransactionId is falsy', 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 () { it('should call history.push', async function () {
await wrapper.instance().onSubmit(MOCK_EVENT) await wrapper.instance().onSubmit(MOCK_EVENT)
assert.equal(historySpies.push.callCount, 1) assert.strictEqual(historySpies.push.callCount, 1)
assert.equal( assert.strictEqual(
historySpies.push.getCall(0).args[0], historySpies.push.getCall(0).args[0],
CONFIRM_TRANSACTION_ROUTE, CONFIRM_TRANSACTION_ROUTE,
) )
@ -234,22 +234,22 @@ describe('SendFooter Component', function () {
}) })
it('should render a PageContainerFooter 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 () { it('should pass the correct props to PageContainerFooter', function () {
const { onCancel, onSubmit, disabled } = wrapper const { onCancel, onSubmit, disabled } = wrapper
.find(PageContainerFooter) .find(PageContainerFooter)
.props() .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) 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() onCancel()
assert.equal(SendFooter.prototype.onCancel.callCount, 1) assert.strictEqual(SendFooter.prototype.onCancel.callCount, 1)
}) })
}) })
}) })

@ -82,7 +82,9 @@ describe('send-footer container', function () {
gasPrice: 'mockGasPrice', gasPrice: 'mockGasPrice',
}) })
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert.deepEqual(utilsStubs.constructTxParams.getCall(0).args[0], { assert.deepStrictEqual(
utilsStubs.constructTxParams.getCall(0).args[0],
{
data: undefined, data: undefined,
sendToken: { sendToken: {
address: '0xabc', address: '0xabc',
@ -92,8 +94,9 @@ describe('send-footer container', function () {
from: 'mockFrom', from: 'mockFrom',
gas: 'mockGas', gas: 'mockGas',
gasPrice: 'mockGasPrice', gasPrice: 'mockGasPrice',
}) },
assert.deepEqual(actionSpies.signTokenTx.getCall(0).args, [ )
assert.deepStrictEqual(actionSpies.signTokenTx.getCall(0).args, [
'0xabc', '0xabc',
'mockTo', 'mockTo',
'mockAmount', 'mockAmount',
@ -111,7 +114,9 @@ describe('send-footer container', function () {
gasPrice: 'mockGasPrice', gasPrice: 'mockGasPrice',
}) })
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert.deepEqual(utilsStubs.constructTxParams.getCall(0).args[0], { assert.deepStrictEqual(
utilsStubs.constructTxParams.getCall(0).args[0],
{
data: undefined, data: undefined,
sendToken: undefined, sendToken: undefined,
to: 'mockTo', to: 'mockTo',
@ -119,8 +124,9 @@ describe('send-footer container', function () {
from: 'mockFrom', from: 'mockFrom',
gas: 'mockGas', gas: 'mockGas',
gasPrice: 'mockGasPrice', gasPrice: 'mockGasPrice',
}) },
assert.deepEqual(actionSpies.signTx.getCall(0).args, [ )
assert.deepStrictEqual(actionSpies.signTx.getCall(0).args, [
{ value: 'mockAmount' }, { value: 'mockAmount' },
]) ])
}) })
@ -139,7 +145,9 @@ describe('send-footer container', function () {
unapprovedTxs: 'mockUnapprovedTxs', unapprovedTxs: 'mockUnapprovedTxs',
}) })
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert.deepEqual(utilsStubs.constructUpdatedTx.getCall(0).args[0], { assert.deepStrictEqual(
utilsStubs.constructUpdatedTx.getCall(0).args[0],
{
data: undefined, data: undefined,
to: 'mockTo', to: 'mockTo',
amount: 'mockAmount', amount: 'mockAmount',
@ -149,8 +157,9 @@ describe('send-footer container', function () {
editingTransactionId: 'mockEditingTransactionId', editingTransactionId: 'mockEditingTransactionId',
sendToken: { address: 'mockAddress' }, sendToken: { address: 'mockAddress' },
unapprovedTxs: 'mockUnapprovedTxs', unapprovedTxs: 'mockUnapprovedTxs',
}) },
assert.equal( )
assert.strictEqual(
actionSpies.updateTransaction.getCall(0).args[0], actionSpies.updateTransaction.getCall(0).args[0],
'mockConstructedUpdatedTxParams', 'mockConstructedUpdatedTxParams',
) )
@ -165,11 +174,11 @@ describe('send-footer container', function () {
'mockNickname', 'mockNickname',
) )
assert(dispatchSpy.calledOnce) assert(dispatchSpy.calledOnce)
assert.equal( assert.strictEqual(
utilsStubs.addressIsNew.getCall(0).args[0], utilsStubs.addressIsNew.getCall(0).args[0],
'mockToAccounts', 'mockToAccounts',
) )
assert.deepEqual(actionSpies.addToAddressBook.getCall(0).args, [ assert.deepStrictEqual(actionSpies.addToAddressBook.getCall(0).args, [
'0xmockNewAddress', '0xmockNewAddress',
'mockNickname', 'mockNickname',
]) ])

@ -19,7 +19,7 @@ const { addressIsNew, constructTxParams, constructUpdatedTx } = sendUtils
describe('send-footer utils', function () { describe('send-footer utils', function () {
describe('addressIsNew()', function () { describe('addressIsNew()', function () {
it('should return false if the address exists in toAccounts', function () { it('should return false if the address exists in toAccounts', function () {
assert.equal( assert.strictEqual(
addressIsNew( addressIsNew(
[{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }], [{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }],
'0xdef', '0xdef',
@ -29,7 +29,7 @@ describe('send-footer utils', function () {
}) })
it('should return true if the address does not exists in toAccounts', function () { it('should return true if the address does not exists in toAccounts', function () {
assert.equal( assert.strictEqual(
addressIsNew( addressIsNew(
[{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }], [{ address: '0xabc' }, { address: '0xdef' }, { address: '0xghi' }],
'0xxyz', '0xxyz',
@ -41,7 +41,7 @@ describe('send-footer utils', function () {
describe('constructTxParams()', function () { describe('constructTxParams()', function () {
it('should return a new txParams object with data if there data is given', function () { it('should return a new txParams object with data if there data is given', function () {
assert.deepEqual( assert.deepStrictEqual(
constructTxParams({ constructTxParams({
data: 'someData', data: 'someData',
sendToken: undefined, 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 () { it('should return a new txParams object with value and to properties if there is no sendToken', function () {
assert.deepEqual( assert.deepStrictEqual(
constructTxParams({ constructTxParams({
sendToken: undefined, sendToken: undefined,
to: 'mockTo', 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 () { 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({ constructTxParams({
sendToken: { address: '0x0' }, sendToken: { address: '0x0' },
to: 'mockTo', to: 'mockTo',
@ -124,7 +124,7 @@ describe('send-footer utils', function () {
}, },
}, },
}) })
assert.deepEqual(result, { assert.deepStrictEqual(result, {
unapprovedTxParam: 'someOtherParam', unapprovedTxParam: 'someOtherParam',
txParams: { txParams: {
from: '0xmockFrom', from: '0xmockFrom',
@ -159,7 +159,7 @@ describe('send-footer utils', function () {
}, },
}) })
assert.deepEqual(result, { assert.deepStrictEqual(result, {
unapprovedTxParam: 'someOtherParam', unapprovedTxParam: 'someOtherParam',
txParams: { txParams: {
from: '0xmockFrom', from: '0xmockFrom',
@ -191,7 +191,7 @@ describe('send-footer utils', function () {
}, },
}) })
assert.deepEqual(result, { assert.deepStrictEqual(result, {
unapprovedTxParam: 'someOtherParam', unapprovedTxParam: 'someOtherParam',
txParams: { txParams: {
from: '0xmockFrom', from: '0xmockFrom',

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save