Use eslint@6.8.0 (#8978)

* Use eslint@6.8.0
* yarn lint:fix
feature/default_network_editable
Whymarrh Whitby 4 years ago committed by GitHub
parent 07237e3dbf
commit 4f0a205369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/scripts/background.js
  2. 6
      app/scripts/contentscript.js
  3. 4
      app/scripts/controllers/alert.js
  4. 22
      app/scripts/controllers/permissions/index.js
  5. 4
      app/scripts/controllers/permissions/methodMiddleware.js
  6. 4
      app/scripts/controllers/permissions/permissionsLog.js
  7. 2
      app/scripts/controllers/permissions/restrictedMethods.js
  8. 2
      app/scripts/controllers/transactions/pending-tx-tracker.js
  9. 2
      app/scripts/lib/get-first-preferred-lang-code.js
  10. 2
      app/scripts/lib/stream-utils.js
  11. 2
      app/scripts/lib/typed-message-manager.js
  12. 12
      app/scripts/metamask-controller.js
  13. 2
      development/build/display.js
  14. 2
      development/build/etc.js
  15. 16
      development/build/index.js
  16. 6
      development/build/scripts.js
  17. 4
      package.json
  18. 2
      test/e2e/tests/localization.spec.js
  19. 2
      test/e2e/tests/personal-sign.spec.js
  20. 2
      test/e2e/tests/simple-send.spec.js
  21. 2
      test/e2e/webdriver/driver.js
  22. 2
      test/unit/app/controllers/detect-tokens-test.js
  23. 12
      test/unit/app/controllers/metamask-controller-test.js
  24. 22
      test/unit/app/controllers/permissions/helpers.js
  25. 2
      test/unit/app/controllers/permissions/mocks.js
  26. 302
      test/unit/app/controllers/permissions/permissions-controller-test.js
  27. 74
      test/unit/app/controllers/permissions/permissions-log-controller-test.js
  28. 152
      test/unit/app/controllers/permissions/permissions-middleware-test.js
  29. 10
      test/unit/app/controllers/permissions/restricted-methods-test.js
  30. 2
      ui/app/components/app/account-menu/tests/account-menu.test.js
  31. 2
      ui/app/components/app/app-header/app-header.container.js
  32. 2
      ui/app/components/app/app-header/tests/app-header.test.js
  33. 4
      ui/app/components/app/asset-list/asset-list.js
  34. 2
      ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js
  35. 4
      ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js
  36. 2
      ui/app/components/app/dropdowns/network-dropdown.js
  37. 2
      ui/app/components/app/dropdowns/tests/dropdown.test.js
  38. 4
      ui/app/components/app/dropdowns/tests/menu.test.js
  39. 2
      ui/app/components/app/dropdowns/tests/network-dropdown.test.js
  40. 2
      ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
  41. 4
      ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js
  42. 8
      ui/app/components/app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js
  43. 4
      ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js
  44. 4
      ui/app/components/app/menu-bar/tests/menu-bar.test.js
  45. 6
      ui/app/components/app/modal/modal-content/tests/modal-content.component.test.js
  46. 10
      ui/app/components/app/modal/tests/modal.component.test.js
  47. 2
      ui/app/components/app/modals/cancel-transaction/cancel-transaction-gas-fee/tests/cancel-transaction-gas-fee.component.test.js
  48. 2
      ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js
  49. 4
      ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js
  50. 2
      ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js
  51. 2
      ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js
  52. 2
      ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js
  53. 2
      ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js
  54. 2
      ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js
  55. 2
      ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js
  56. 2
      ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js
  57. 2
      ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.container.js
  58. 2
      ui/app/components/app/modals/metametrics-opt-in-modal/tests/metametrics-opt-in-modal.test.js
  59. 2
      ui/app/components/app/modals/reject-transactions/tests/reject-transactions.test.js
  60. 2
      ui/app/components/app/modals/tests/account-details-modal.test.js
  61. 2
      ui/app/components/app/modals/transaction-confirmed/tests/transaction-confirmed.test.js
  62. 6
      ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js
  63. 4
      ui/app/components/app/permission-page-container/permission-page-container.component.js
  64. 2
      ui/app/components/app/signature-request-original/signature-request-original.container.js
  65. 2
      ui/app/components/app/tests/signature-request.test.js
  66. 2
      ui/app/components/app/token-cell/token-cell.test.js
  67. 4
      ui/app/components/app/transaction-action/tests/transaction-action.component.test.js
  68. 6
      ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js
  69. 2
      ui/app/components/app/transaction-breakdown/tests/transaction-breakdown.component.test.js
  70. 4
      ui/app/components/app/transaction-breakdown/transaction-breakdown-row/tests/transaction-breakdown-row.component.test.js
  71. 8
      ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js
  72. 4
      ui/app/components/app/transaction-list/transaction-list.component.js
  73. 10
      ui/app/components/app/transaction-status/tests/transaction-status.component.test.js
  74. 4
      ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js
  75. 4
      ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.component.test.js
  76. 4
      ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.component.test.js
  77. 2
      ui/app/components/ui/account-mismatch-warning/tests/acccount-mismatch-warning.component.test.js
  78. 2
      ui/app/components/ui/alert/tests/alert.test.js
  79. 2
      ui/app/components/ui/breadcrumbs/tests/breadcrumbs.component.test.js
  80. 2
      ui/app/components/ui/button/button.component.js
  81. 2
      ui/app/components/ui/card/tests/card.component.test.js
  82. 18
      ui/app/components/ui/currency-input/tests/currency-input.component.test.js
  83. 2
      ui/app/components/ui/dropdown/dropdown.js
  84. 8
      ui/app/components/ui/dropdown/dropdown.stories.js
  85. 4
      ui/app/components/ui/error-message/tests/error-message.component.test.js
  86. 6
      ui/app/components/ui/identicon/tests/identicon.component.test.js
  87. 2
      ui/app/components/ui/list-item/tests/list-item.test.js
  88. 2
      ui/app/components/ui/menu/menu.js
  89. 4
      ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js
  90. 2
      ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js
  91. 10
      ui/app/components/ui/token-input/tests/token-input.component.test.js
  92. 16
      ui/app/components/ui/unit-input/tests/unit-input.component.test.js
  93. 2
      ui/app/contexts/metametrics.js
  94. 56
      ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js
  95. 92
      ui/app/ducks/gas/gas-duck.test.js
  96. 4
      ui/app/ducks/gas/gas.duck.js
  97. 2
      ui/app/helpers/higher-order-components/with-modal-props/tests/with-modal-props.test.js
  98. 20
      ui/app/helpers/utils/confirm-tx.util.test.js
  99. 2
      ui/app/helpers/utils/conversion-util.js
  100. 4
      ui/app/helpers/utils/token-util.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -260,7 +260,7 @@ function setupController (initState, initLangCode) {
createStreamSink(persistData),
(error) => {
log.error('MetaMask - Persistence pipeline failed', error)
}
},
)
/**
@ -454,7 +454,7 @@ async function openPopup () {
resolve()
}
}, 1000)
}
},
)
}

@ -77,13 +77,13 @@ async function setupStreams () {
pageMux,
pageStream,
pageMux,
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err)
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err),
)
pump(
extensionMux,
extensionStream,
extensionMux,
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err)
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err),
)
// forward communication across inpage-background for these channels only
@ -102,7 +102,7 @@ function forwardTrafficBetweenMuxers (channelName, muxA, muxB) {
channelA,
channelB,
channelA,
(err) => logStreamDisconnectWarning(`MetaMask muxed traffic for channel "${channelName}" failed.`, err)
(err) => logStreamDisconnectWarning(`MetaMask muxed traffic for channel "${channelName}" failed.`, err),
)
}

@ -22,7 +22,7 @@ const defaultState = {
alertEnabledness[alertType] = true
return alertEnabledness
},
{}
{},
),
unconnectedAccountAlertShownOrigins: {},
}
@ -44,7 +44,7 @@ export default class AlertController {
initState,
{
unconnectedAccountAlertShownOrigins: {},
}
},
)
this.store = new ObservableStore(state)

@ -102,7 +102,7 @@ export class PermissionsController {
}))
engine.push(this.permissions.providerMiddlewareFunction.bind(
this.permissions, { origin }
this.permissions, { origin },
))
return asMiddleware(engine)
@ -132,7 +132,7 @@ export class PermissionsController {
const req = { method: 'eth_accounts' }
const res = {}
this.permissions.providerMiddlewareFunction(
{ origin }, req, res, () => {}, _end
{ origin }, req, res, () => {}, _end,
)
function _end () {
@ -187,7 +187,7 @@ export class PermissionsController {
const res = {}
this.permissions.providerMiddlewareFunction(
domain, req, res, () => {}, _end
domain, req, res, () => {}, _end,
)
function _end (_err) {
@ -233,7 +233,7 @@ export class PermissionsController {
// attempt to finalize the request and resolve it,
// settings caveats as necessary
approved.permissions = await this.finalizePermissionsRequest(
approved.permissions, accounts
approved.permissions, accounts,
)
approval.resolve(approved.permissions)
}
@ -295,7 +295,7 @@ export class PermissionsController {
this.permissions.updateCaveatFor(
origin, 'eth_accounts',
CAVEAT_NAMES.exposedAccounts,
[...oldPermittedAccounts, account]
[...oldPermittedAccounts, account],
)
const permittedAccounts = await this.getAccounts(origin)
@ -459,7 +459,7 @@ export class PermissionsController {
// update "last seen" time for the origin and account(s)
// exception: no accounts -> no times to update
this.permissionsLog.updateAccountsHistory(
origin, newAccounts
origin, newAccounts,
)
// NOTE:
@ -490,7 +490,7 @@ export class PermissionsController {
}
return { parentCapability: methodName }
})
}),
)
})
}
@ -642,8 +642,8 @@ export class PermissionsController {
await Promise.all(
connectedDomains
.map(
(origin) => this._handleConnectedAccountSelected(origin)
)
(origin) => this._handleConnectedAccountSelected(origin),
),
)
}
@ -675,7 +675,7 @@ export class PermissionsController {
this.pendingApprovals.has(id)
) {
throw new Error(
`Pending approval with id '${id}' or origin '${origin}' already exists.`
`Pending approval with id '${id}' or origin '${origin}' already exists.`,
)
}
@ -728,7 +728,7 @@ export class PermissionsController {
if (this.pendingApprovalOrigins.has(origin)) {
throw ethErrors.rpc.resourceUnavailable(
'Permissions request already pending; please wait.'
'Permissions request already pending; please wait.',
)
}

@ -33,7 +33,7 @@ export default function createMethodMiddleware ({
if (isProcessingRequestAccounts) {
res.error = ethErrors.rpc.resourceUnavailable(
'Already processing eth_requestAccounts. Please wait.'
'Already processing eth_requestAccounts. Please wait.',
)
return
}
@ -68,7 +68,7 @@ export default function createMethodMiddleware ({
// this should never happen, because it should be caught in the
// above catch clause
res.error = ethErrors.rpc.internal(
'Accounts unexpectedly unavailable. Please report this bug.'
'Accounts unexpectedly unavailable. Please report this bug.',
)
}

@ -213,7 +213,7 @@ export default class PermissionsLogController {
*/
logPermissionsHistory (
requestedMethods, origin, result,
time, isEthRequestAccounts
time, isEthRequestAccounts,
) {
let accounts, newEntries
@ -378,6 +378,6 @@ export default class PermissionsLogController {
*/
function getAccountToTimeMap (accounts, time) {
return accounts.reduce(
(acc, account) => ({ ...acc, [account]: time }), {}
(acc, account) => ({ ...acc, [account]: time }), {},
)
}

@ -27,7 +27,7 @@ export default function getRestrictedMethods ({ getIdentities, getKeyringAccount
(err) => {
res.error = err
end(err)
}
},
)
},
},

@ -243,7 +243,7 @@ export default class PendingTransactionTracker extends EventEmitter {
// This is called while the transaction is in-flight, so it is possible that the
// list of completed transactions now includes the transaction we were looking at
// and if that is the case, don't consider the transaction to have taken its own nonce
!(other.id === txMeta.id) && other.txParams.nonce === txMeta.txParams.nonce
!(other.id === txMeta.id) && other.txParams.nonce === txMeta.txParams.nonce,
)
}
}

@ -4,7 +4,7 @@ import allLocales from '../../_locales/index.json'
const getPreferredLocales = extension.i18n ? promisify(
extension.i18n.getAcceptLanguages,
{ errorFirst: false }
{ errorFirst: false },
) : async () => []
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)

@ -16,7 +16,7 @@ export function setupMultiplex (connectionStream) {
if (err) {
console.error(err)
}
}
},
)
return mux
}

@ -143,7 +143,7 @@ export default class TypedMessageManager extends EventEmitter {
assert.ok('from' in params, 'Params must include a "from" field.')
assert.ok(
typeof params.from === 'string' && isValidAddress(params.from),
'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.'
'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.',
)
switch (params.version) {

@ -273,7 +273,7 @@ export default class MetamaskController extends EventEmitter {
if (error) {
throw error
}
}
},
)
})
@ -717,7 +717,7 @@ export default class MetamaskController extends EventEmitter {
const tokenAddress = ethUtil.toChecksumAddress(address)
return contractMap[tokenAddress] ? contractMap[tokenAddress].erc20 : true
})
)
),
)
})
@ -735,7 +735,7 @@ export default class MetamaskController extends EventEmitter {
const simpleKeyPairKeyrings = this.keyringController.getKeyringsByType('Simple Key Pair')
const hdAccounts = await hdKeyring.getAccounts()
const simpleKeyPairKeyringAccounts = await Promise.all(
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts())
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts()),
)
const simpleKeyPairAccounts = simpleKeyPairKeyringAccounts.reduce((acc, accounts) => [...acc, ...accounts], [])
const accounts = {
@ -1523,7 +1523,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
dnode.on('remote', (remote) => {
// push updates to popup
@ -1575,7 +1575,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
}
@ -1650,7 +1650,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
}

@ -34,7 +34,7 @@ function setupTaskDisplay (taskEvents) {
function displayChart (data) {
// sort tasks by start time
data.sort((a, b,) => a[1] - b[1])
data.sort((a, b) => a[1] - b[1])
// get bounds
const first = Math.min(...data.map((entry) => entry[1]))

@ -25,7 +25,7 @@ function createEtcTasks ({ browserPlatforms, livereload }) {
// zip tasks for distribution
const zip = createTask('zip', composeParallel(
...browserPlatforms.map((platform) => createZipTask(platform))
...browserPlatforms.map((platform) => createZipTask(platform)),
))
return { clean, reload, zip }

@ -39,9 +39,9 @@ function defineAllTasks () {
scriptTasks.dev,
staticTasks.dev,
manifestTasks.dev,
reload
)
)
reload,
),
),
)
// build for test development (livereload)
@ -53,9 +53,9 @@ function defineAllTasks () {
scriptTasks.testDev,
staticTasks.dev,
manifestTasks.testDev,
reload
)
)
reload,
),
),
)
// build for prod release
@ -69,7 +69,7 @@ function defineAllTasks () {
manifestTasks.prod,
),
zip,
)
),
)
// build for CI testing
@ -82,7 +82,7 @@ function defineAllTasks () {
staticTasks.prod,
manifestTasks.test,
),
)
),
)
// special build for minimal CI testing

@ -94,13 +94,13 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
const standardSubtasks = standardBundles.map((filename) => {
return createTask(`${taskPrefix}:${filename}`,
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing })
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing }),
)
})
// inpage must be built before contentscript
// because inpage bundle result is included inside contentscript
const contentscriptSubtask = createTask(`${taskPrefix}:contentscript`,
createTaskForBuildJsExtensionContentscript({ devMode, testing })
createTaskForBuildJsExtensionContentscript({ devMode, testing }),
)
// task for initiating livereload
@ -156,7 +156,7 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
externalDependencies: devMode ? undefined : externalDependenciesMap[contentscript],
devMode,
testing,
})
}),
)
}

@ -188,7 +188,7 @@
"@storybook/storybook-deployer": "^2.8.6",
"@testing-library/react-hooks": "^3.2.1",
"addons-linter": "1.14.0",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"babelify": "^10.0.0",
"brfs": "^1.6.1",
@ -207,7 +207,7 @@
"envify": "^4.1.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^6.0.1",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-json": "^1.2.0",

@ -23,7 +23,7 @@ describe('Localization', function () {
const [fiatAmount, fiatUnit] = secondaryBalanceText.trim().split(/\s+/)
assert.ok(fiatAmount.startsWith('₱'))
assert.equal(fiatUnit, 'PHP')
}
},
)
})
})

@ -34,7 +34,7 @@ describe('Personal sign', function () {
await driver.clickElement(By.css('[data-testid="request-signature__sign"]'))
await driver.waitUntilXWindowHandles(2)
}
},
)
})
})

@ -26,7 +26,7 @@ describe('Simple send', function () {
await driver.clickElement(By.css('[data-testid="page-container-footer-next"]'))
await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))
await driver.findElement(By.css('.transaction-list-item'))
}
},
)
})
})

@ -61,7 +61,7 @@ class Driver {
this.driver.wait(until.elementIsEnabled(element), this.timeout),
)
return acc
}, [])
}, []),
)
return elements
}

@ -117,7 +117,7 @@ describe('DetectTokensController', function () {
[
{ address: existingTokenAddress.toLowerCase(), decimals: existingToken.decimals, symbol: existingToken.symbol },
{ address: tokenAddressToAdd.toLowerCase(), decimals: tokenToAdd.decimals, symbol: tokenToAdd.symbol },
]
],
)
})

@ -244,7 +244,7 @@ describe('MetaMaskController', function () {
firstVaultIdentities[TEST_ADDRESS].lastSelected >= startTime &&
firstVaultIdentities[TEST_ADDRESS].lastSelected <= endTime
),
`'${firstVaultIdentities[TEST_ADDRESS].lastSelected}' expected to be between '${startTime}' and '${endTime}'`
`'${firstVaultIdentities[TEST_ADDRESS].lastSelected}' expected to be between '${startTime}' and '${endTime}'`,
)
delete firstVaultIdentities[TEST_ADDRESS].lastSelected
assert.deepEqual(firstVaultIdentities, {
@ -269,7 +269,7 @@ describe('MetaMaskController', function () {
secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected >= startTime &&
secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected <= endTime
),
`'${secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected}' expected to be between '${startTime}' and '${endTime}'`
`'${secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected}' expected to be between '${startTime}' and '${endTime}'`,
)
delete secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected
assert.deepEqual(secondVaultIdentities, {
@ -404,7 +404,7 @@ describe('MetaMaskController', function () {
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
await metamaskController.connectHardware('trezor', 0).catch(() => null)
const keyrings = await metamaskController.keyringController.getKeyringsByType(
'Trezor Hardware'
'Trezor Hardware',
)
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Trezor Hardware')
assert.equal(keyrings.length, 1)
@ -414,7 +414,7 @@ describe('MetaMaskController', function () {
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
await metamaskController.connectHardware('ledger', 0).catch(() => null)
const keyrings = await metamaskController.keyringController.getKeyringsByType(
'Ledger Hardware'
'Ledger Hardware',
)
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Ledger Hardware')
assert.equal(keyrings.length, 1)
@ -451,7 +451,7 @@ describe('MetaMaskController', function () {
await metamaskController.connectHardware('trezor', 0).catch(() => null)
await metamaskController.forgetDevice('trezor')
const keyrings = await metamaskController.keyringController.getKeyringsByType(
'Trezor Hardware'
'Trezor Hardware',
)
assert.deepEqual(keyrings[0].accounts, [])
@ -498,7 +498,7 @@ describe('MetaMaskController', function () {
it('should set unlockedAccount in the keyring', async function () {
const keyrings = await metamaskController.keyringController.getKeyringsByType(
'Trezor Hardware'
'Trezor Hardware',
)
assert.equal(keyrings[0].unlockedAccount, accountToUnlock)
})

@ -14,7 +14,7 @@ import { noop } from './mocks'
*/
export function grantPermissions (permController, origin, permissions) {
permController.permissions.grantNewPermissions(
origin, permissions, {}, noop
origin, permissions, {}, noop,
)
}
@ -53,20 +53,20 @@ export function getUserApprovalPromise (permController) {
* @param {boolean} success - Whether the request succeeded or not.
*/
export function validateActivityEntry (
entry, req, res, methodType, success
entry, req, res, methodType, success,
) {
assert.doesNotThrow(
() => {
_validateActivityEntry(
entry, req, res, methodType, success
entry, req, res, methodType, success,
)
},
'should have expected activity entry'
'should have expected activity entry',
)
}
function _validateActivityEntry (
entry, req, res, methodType, success
entry, req, res, methodType, success,
) {
assert.ok(entry, 'entry should exist')
@ -77,7 +77,7 @@ function _validateActivityEntry (
assert.equal(entry.methodType, methodType)
assert.deepEqual(
entry.request, req,
'entry.request should equal the request'
'entry.request should equal the request',
)
if (res) {
@ -87,23 +87,23 @@ function _validateActivityEntry (
Number.isInteger(entry.requestTime) &&
Number.isInteger(entry.responseTime)
),
'request and response times should be numbers'
'request and response times should be numbers',
)
assert.ok(
(entry.requestTime <= entry.responseTime),
'request time should be less than response time'
'request time should be less than response time',
)
assert.equal(entry.success, success)
assert.deepEqual(
entry.response, res,
'entry.response should equal the response'
'entry.response should equal the response',
)
} else {
assert.ok(
Number.isInteger(entry.requestTime) && entry.requestTime > 0,
'entry should have non-zero request time'
'entry should have non-zero request time',
)
assert.ok(
(
@ -111,7 +111,7 @@ function _validateActivityEntry (
entry.responseTime === null &&
entry.response === null
),
'entry response values should be null'
'entry response values should be null',
)
}
}

@ -41,7 +41,7 @@ const getIdentities = () => {
identities[address] = { address, name: `Account ${index}` }
return identities
},
{}
{},
)
}

@ -100,7 +100,7 @@ describe('permissions log', function () {
assert.equal(log.length, 1, 'log should have single entry')
validateActivityEntry(
entry1, { ...req }, { ...res },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
// eth_accounts, failure
@ -117,7 +117,7 @@ describe('permissions log', function () {
assert.equal(log.length, 2, 'log should have 2 entries')
validateActivityEntry(
entry2, { ...req }, { ...res },
LOG_METHOD_TYPES.restricted, false
LOG_METHOD_TYPES.restricted, false,
)
// eth_requestAccounts, success
@ -134,7 +134,7 @@ describe('permissions log', function () {
assert.equal(log.length, 3, 'log should have 3 entries')
validateActivityEntry(
entry3, { ...req }, { ...res },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
// test_method, no response
@ -151,7 +151,7 @@ describe('permissions log', function () {
assert.equal(log.length, 4, 'log should have 4 entries')
validateActivityEntry(
entry4, { ...req }, null,
LOG_METHOD_TYPES.restricted, false
LOG_METHOD_TYPES.restricted, false,
)
// validate final state
@ -199,7 +199,7 @@ describe('permissions log', function () {
entry2.id === id2 && entry2.response === null &&
entry3.id === id3 && entry3.response === null
),
'all entries should be in correct order and without responses'
'all entries should be in correct order and without responses',
)
// call response handlers
@ -216,17 +216,17 @@ describe('permissions log', function () {
validateActivityEntry(
log[0], { ...req, id: id1 }, { ...res1 },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
validateActivityEntry(
log[1], { ...req, id: id2 }, { ...res2 },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
validateActivityEntry(
log[2], { ...req, id: id3 }, { ...res3 },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
})
@ -245,7 +245,7 @@ describe('permissions log', function () {
assert.equal(log.length, 1, 'log should have single entry')
validateActivityEntry(
entry1, { ...req }, null,
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
// next request should be handled as normal
@ -260,7 +260,7 @@ describe('permissions log', function () {
assert.equal(log.length, 2, 'log should have 2 entries')
validateActivityEntry(
entry2, { ...req }, { ...res },
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
// validate final state
@ -301,12 +301,12 @@ describe('permissions log', function () {
// check last entry valid
let log = permLog.getActivityLog()
assert.equal(
log.length, LOG_LIMIT, 'log should have LOG_LIMIT num entries'
log.length, LOG_LIMIT, 'log should have LOG_LIMIT num entries',
)
validateActivityEntry(
log[LOG_LIMIT - 1], { ...req, id: lastId }, res,
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
// store the id of the current second entry
@ -319,18 +319,18 @@ describe('permissions log', function () {
// check log length
log = permLog.getActivityLog()
assert.equal(
log.length, LOG_LIMIT, 'log should have LOG_LIMIT num entries'
log.length, LOG_LIMIT, 'log should have LOG_LIMIT num entries',
)
// check first and last entries
validateActivityEntry(
log[0], { ...req, id: nextFirstId }, res,
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
validateActivityEntry(
log[LOG_LIMIT - 1], { ...req, id: lastId }, res,
LOG_METHOD_TYPES.restricted, true
LOG_METHOD_TYPES.restricted, true,
)
})
})
@ -354,7 +354,7 @@ describe('permissions log', function () {
let permHistory
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
)
const res = { result: [ PERMS.granted.test_method() ] }
@ -370,18 +370,18 @@ describe('permissions log', function () {
permHistory = permLog.getHistory()
assert.equal(
Object.keys(permHistory).length, 1,
'history should have single origin'
'history should have single origin',
)
assert.ok(
Boolean(permHistory[DOMAINS.a.origin]),
'history should have expected origin'
'history should have expected origin',
)
})
it('ignores malformed permissions requests', function () {
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
)
delete req.params
const res = { result: [ PERMS.granted.test_method() ] }
@ -397,7 +397,7 @@ describe('permissions log', function () {
let permHistory
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
@ -412,7 +412,7 @@ describe('permissions log', function () {
assert.deepEqual(
permHistory,
EXPECTED_HISTORIES.case1[0],
'should have correct history'
'should have correct history',
)
// mock permission requested again, with another approved account
@ -428,14 +428,14 @@ describe('permissions log', function () {
assert.deepEqual(
permHistory,
EXPECTED_HISTORIES.case1[1],
'should have correct history'
'should have correct history',
)
})
it('handles eth_accounts response without caveats', async function () {
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
@ -448,14 +448,14 @@ describe('permissions log', function () {
assert.deepEqual(
permLog.getHistory(), EXPECTED_HISTORIES.case2[0],
'should have expected history'
'should have expected history',
)
})
it('handles extra caveats for eth_accounts', async function () {
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
@ -469,7 +469,7 @@ describe('permissions log', function () {
assert.deepEqual(
permLog.getHistory(),
EXPECTED_HISTORIES.case1[0],
'should have correct history'
'should have correct history',
)
})
@ -478,7 +478,7 @@ describe('permissions log', function () {
it('handles unrequested permissions on the response', async function () {
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {
result: [
@ -494,14 +494,14 @@ describe('permissions log', function () {
assert.deepEqual(
permLog.getHistory(),
EXPECTED_HISTORIES.case1[0],
'should have correct history'
'should have correct history',
)
})
it('does not update history if no new permissions are approved', async function () {
let req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
)
let res = {
result: [
@ -516,7 +516,7 @@ describe('permissions log', function () {
assert.deepEqual(
permLog.getHistory(),
EXPECTED_HISTORIES.case4[0],
'should have correct history'
'should have correct history',
)
// new permission requested, but not approved
@ -524,7 +524,7 @@ describe('permissions log', function () {
clock.tick(1)
req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
res = {
result: [
@ -539,7 +539,7 @@ describe('permissions log', function () {
assert.deepEqual(
permLog.getHistory(),
EXPECTED_HISTORIES.case4[0],
'should have same history as before'
'should have same history as before',
)
})
@ -555,7 +555,7 @@ describe('permissions log', function () {
// first origin
round1.push({
req: RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
),
res: {
result: [ PERMS.granted.test_method() ],
@ -565,7 +565,7 @@ describe('permissions log', function () {
// second origin
round1.push({
req: RPC_REQUESTS.requestPermission(
DOMAINS.b.origin, PERM_NAMES.eth_accounts
DOMAINS.b.origin, PERM_NAMES.eth_accounts,
),
res: {
result: [ PERMS.granted.eth_accounts(ACCOUNTS.b.permitted) ],
@ -600,7 +600,7 @@ describe('permissions log', function () {
assert.deepEqual(
permHistory, EXPECTED_HISTORIES.case3[0],
'should have expected history'
'should have expected history',
)
// make next round of requests
@ -613,7 +613,7 @@ describe('permissions log', function () {
// first origin
round2.push({
req: RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
),
res: {
result: [ PERMS.granted.test_method() ],
@ -644,7 +644,7 @@ describe('permissions log', function () {
assert.deepEqual(
permHistory, EXPECTED_HISTORIES.case3[1],
'should have expected history'
'should have expected history',
)
})
})

@ -66,13 +66,13 @@ describe('permissions middleware', function () {
const aMiddleware = getPermissionsMiddleware(permController, DOMAINS.a.origin)
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {}
const pendingApproval = assert.doesNotReject(
aMiddleware(req, res),
'should not reject permissions request'
'should not reject permissions request',
)
assert.equal(
@ -88,32 +88,32 @@ describe('permissions middleware', function () {
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.equal(
res.result.length, 1,
'origin should have single approved permission'
'origin should have single approved permission',
)
validatePermission(
res.result[0],
PERM_NAMES.eth_accounts,
DOMAINS.a.origin,
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
)
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
aAccounts, [ACCOUNTS.a.primary],
'origin should have correct accounts'
'origin should have correct accounts',
)
assert.ok(
permController.notifyAccountsChanged.calledOnceWith(
DOMAINS.a.origin, aAccounts,
),
'expected notification call should have been made'
'expected notification call should have been made',
)
})
@ -124,7 +124,7 @@ describe('permissions middleware', function () {
// create first request
const req1 = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res1 = {}
@ -133,7 +133,7 @@ describe('permissions middleware', function () {
const pendingApproval1 = assert.doesNotReject(
aMiddleware(req1, res1),
'should not reject permissions request'
'should not reject permissions request',
)
const id1 = permController.pendingApprovals.keys().next().value
@ -144,32 +144,32 @@ describe('permissions middleware', function () {
assert.ok(
res1.result && !res1.error,
'response should have result and no error'
'response should have result and no error',
)
assert.equal(
res1.result.length, 1,
'origin should have single approved permission'
'origin should have single approved permission',
)
validatePermission(
res1.result[0],
PERM_NAMES.eth_accounts,
DOMAINS.a.origin,
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
)
const accounts1 = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
accounts1, [ACCOUNTS.a.primary],
'origin should have correct accounts'
'origin should have correct accounts',
)
assert.ok(
permController.notifyAccountsChanged.calledOnceWith(
DOMAINS.a.origin, accounts1,
),
'expected notification call should have been made'
'expected notification call should have been made',
)
// create second request
@ -180,7 +180,7 @@ describe('permissions middleware', function () {
}
const req2 = RPC_REQUESTS.requestPermissions(
DOMAINS.a.origin, { ...requestedPerms2 }
DOMAINS.a.origin, { ...requestedPerms2 },
)
const res2 = {}
@ -189,7 +189,7 @@ describe('permissions middleware', function () {
const pendingApproval2 = assert.doesNotReject(
aMiddleware(req2, res2),
'should not reject permissions request'
'should not reject permissions request',
)
const id2 = permController.pendingApprovals.keys().next().value
@ -200,19 +200,19 @@ describe('permissions middleware', function () {
assert.ok(
res2.result && !res2.error,
'response should have result and no error'
'response should have result and no error',
)
assert.equal(
res2.result.length, 2,
'origin should have single approved permission'
'origin should have single approved permission',
)
validatePermission(
res2.result[0],
PERM_NAMES.eth_accounts,
DOMAINS.a.origin,
CAVEATS.eth_accounts(ACCOUNTS.b.permitted)
CAVEATS.eth_accounts(ACCOUNTS.b.permitted),
)
validatePermission(
@ -224,19 +224,19 @@ describe('permissions middleware', function () {
const accounts2 = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
accounts2, [ACCOUNTS.b.primary],
'origin should have correct accounts'
'origin should have correct accounts',
)
assert.equal(
permController.notifyAccountsChanged.callCount, 2,
'should have called notification method 2 times in total'
'should have called notification method 2 times in total',
)
assert.ok(
permController.notifyAccountsChanged.lastCall.calledWith(
DOMAINS.a.origin, accounts2,
),
'expected notification call should have been made'
'expected notification call should have been made',
)
})
@ -245,7 +245,7 @@ describe('permissions middleware', function () {
const aMiddleware = getPermissionsMiddleware(permController, DOMAINS.a.origin)
const req = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.eth_accounts
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
)
const res = {}
@ -272,17 +272,17 @@ describe('permissions middleware', function () {
!res.result && res.error &&
res.error.message === expectedError.message
),
'response should have expected error and no result'
'response should have expected error and no result',
)
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
aAccounts, [], 'origin should have have correct accounts'
aAccounts, [], 'origin should have have correct accounts',
)
assert.ok(
permController.notifyAccountsChanged.notCalled,
'should not have called notification method'
'should not have called notification method',
)
})
@ -294,12 +294,12 @@ describe('permissions middleware', function () {
DOMAINS.a.origin, {
...PERMS.requests.does_not_exist(),
...PERMS.requests.test_method(),
}
},
)
const res = {}
const expectedError = ERRORS.rejectPermissionsRequest.methodNotFound(
PERM_NAMES.does_not_exist
PERM_NAMES.does_not_exist,
)
await assert.rejects(
@ -318,12 +318,12 @@ describe('permissions middleware', function () {
!res.result && res.error &&
res.error.message === expectedError.message
),
'response should have expected error and no result'
'response should have expected error and no result',
)
assert.ok(
permController.notifyAccountsChanged.notCalled,
'should not have called notification method'
'should not have called notification method',
)
})
@ -339,25 +339,25 @@ describe('permissions middleware', function () {
// create and start processing first request for first origin
const reqA1 = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
)
const resA1 = {}
const requestApproval1 = assert.doesNotReject(
aMiddleware(reqA1, resA1),
'should not reject permissions request'
'should not reject permissions request',
)
// create and start processing first request for second origin
const reqB1 = RPC_REQUESTS.requestPermission(
DOMAINS.b.origin, PERM_NAMES.test_method
DOMAINS.b.origin, PERM_NAMES.test_method,
)
const resB1 = {}
const requestApproval2 = assert.doesNotReject(
bMiddleware(reqB1, resB1),
'should not reject permissions request'
'should not reject permissions request',
)
assert.equal(
@ -369,7 +369,7 @@ describe('permissions middleware', function () {
// which should throw
const reqA2 = RPC_REQUESTS.requestPermission(
DOMAINS.a.origin, PERM_NAMES.test_method
DOMAINS.a.origin, PERM_NAMES.test_method,
)
const resA2 = {}
@ -384,7 +384,7 @@ describe('permissions middleware', function () {
!resA2.result && resA2.error &&
resA2.error.message === expectedError.message
),
'response should have expected error and no result'
'response should have expected error and no result',
)
// first requests for both origins should remain
@ -398,7 +398,7 @@ describe('permissions middleware', function () {
for (const id of permController.pendingApprovals.keys()) {
await permController.approvePermissionsRequest(
PERMS.approvedRequest(id, PERMS.requests.test_method())
PERMS.approvedRequest(id, PERMS.requests.test_method()),
)
}
await requestApproval1
@ -406,20 +406,20 @@ describe('permissions middleware', function () {
assert.ok(
resA1.result && !resA1.error,
'first response should have result and no error'
'first response should have result and no error',
)
assert.equal(
resA1.result.length, 1,
'first origin should have single approved permission'
'first origin should have single approved permission',
)
assert.ok(
resB1.result && !resB1.error,
'second response should have result and no error'
'second response should have result and no error',
)
assert.equal(
resB1.result.length, 1,
'second origin should have single approved permission'
'second origin should have single approved permission',
)
assert.equal(
@ -457,7 +457,7 @@ describe('permissions middleware', function () {
!res.result && res.error &&
res.error.code === expectedError.code
),
'response should have expected error and no result'
'response should have expected error and no result',
)
})
@ -472,12 +472,12 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
bMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(
res.result && res.result === 1,
'response should have correct result'
'response should have correct result',
)
})
})
@ -499,16 +499,16 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
aMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.deepEqual(
res.result, [],
'response should have correct result'
'response should have correct result',
)
})
@ -518,7 +518,7 @@ describe('permissions middleware', function () {
grantPermissions(
permController, DOMAINS.a.origin,
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.a.permitted)
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.a.permitted),
)
const req = RPC_REQUESTS.eth_accounts(DOMAINS.a.origin)
@ -526,16 +526,16 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
aMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.deepEqual(
res.result, [ACCOUNTS.a.primary],
'response should have correct result'
'response should have correct result',
)
})
})
@ -559,7 +559,7 @@ describe('permissions middleware', function () {
const pendingApproval = assert.doesNotReject(
aMiddleware(req, res),
'should not reject permissions request'
'should not reject permissions request',
)
await userApprovalPromise
@ -581,31 +581,31 @@ describe('permissions middleware', function () {
assert.equal(
perms.length, 1,
'domain should have correct number of permissions'
'domain should have correct number of permissions',
)
validatePermission(
perms[0],
PERM_NAMES.eth_accounts,
DOMAINS.a.origin,
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
)
// we should also see the accounts on the response
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.deepEqual(
res.result, [ACCOUNTS.a.primary],
'result should have correct accounts'
'result should have correct accounts',
)
// we should also be able to get the accounts independently
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
aAccounts, [ACCOUNTS.a.primary], 'origin should have have correct accounts'
aAccounts, [ACCOUNTS.a.primary], 'origin should have have correct accounts',
)
})
@ -643,12 +643,12 @@ describe('permissions middleware', function () {
!res.result && res.error &&
res.error.message === expectedError.message
),
'response should have expected error and no result'
'response should have expected error and no result',
)
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
assert.deepEqual(
aAccounts, [], 'origin should have have correct accounts'
aAccounts, [], 'origin should have have correct accounts',
)
})
@ -658,7 +658,7 @@ describe('permissions middleware', function () {
grantPermissions(
permController, DOMAINS.c.origin,
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.c.permitted)
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.c.permitted),
)
const req = RPC_REQUESTS.eth_requestAccounts(DOMAINS.c.origin)
@ -666,16 +666,16 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.deepEqual(
res.result, [ACCOUNTS.c.primary],
'response should have correct result'
'response should have correct result',
)
})
@ -692,7 +692,7 @@ describe('permissions middleware', function () {
grantPermissions(
permController, DOMAINS.c.origin,
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.c.permitted)
PERMS.finalizedRequests.eth_accounts(ACCOUNTS.c.permitted),
)
const req = RPC_REQUESTS.eth_requestAccounts(DOMAINS.c.origin)
@ -701,13 +701,13 @@ describe('permissions middleware', function () {
// this will block until we resolve the unlock Promise
const requestApproval = assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
// this will reject because of the already pending request
await assert.rejects(
cMiddleware({ ...req }, {}),
ERRORS.eth_requestAccounts.requestAlreadyPending()
ERRORS.eth_requestAccounts.requestAlreadyPending(),
)
// now unlock and let through the first request
@ -717,11 +717,11 @@ describe('permissions middleware', function () {
assert.ok(
res.result && !res.error,
'response should have result and no error'
'response should have result and no error',
)
assert.deepEqual(
res.result, [ACCOUNTS.c.primary],
'response should have correct result'
'response should have correct result',
)
})
})
@ -750,7 +750,7 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(res.result, 'result should be true')
@ -766,7 +766,7 @@ describe('permissions middleware', function () {
lastUpdated: 1,
},
},
'metadata should have been added to store'
'metadata should have been added to store',
)
})
@ -783,7 +783,7 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(res.result, 'result should be true')
@ -793,7 +793,7 @@ describe('permissions middleware', function () {
assert.deepEqual(
metadataStore,
{ [DOMAINS.c.origin]: { name, extensionId, lastUpdated: 1 } },
'metadata should have been added to store'
'metadata should have been added to store',
)
})
@ -808,7 +808,7 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(res.result, 'result should be true')
@ -817,7 +817,7 @@ describe('permissions middleware', function () {
assert.deepEqual(
metadataStore, {},
'metadata should not have been added to store'
'metadata should not have been added to store',
)
})
@ -831,7 +831,7 @@ describe('permissions middleware', function () {
await assert.doesNotReject(
cMiddleware(req, res),
'should not reject'
'should not reject',
)
assert.ok(res.result, 'result should be true')
@ -840,7 +840,7 @@ describe('permissions middleware', function () {
assert.deepEqual(
metadataStore, {},
'metadata should not have been added to store'
'metadata should not have been added to store',
)
})
})

@ -19,12 +19,12 @@ describe('restricted methods', function () {
await assert.rejects(
ethAccountsMethod(null, res, null),
fooError,
'Should reject with expected error'
'Should reject with expected error',
)
assert.deepEqual(
res, { error: fooError },
'response should have expected error and no result'
'response should have expected error and no result',
)
})
@ -67,7 +67,7 @@ describe('restricted methods', function () {
identities[address] = {}
return identities
},
{}
{},
)
},
getKeyringAccounts: async () => [...keyringAccounts],
@ -88,7 +88,7 @@ describe('restricted methods', function () {
identities[address] = { lastSelected: 1000 }
return identities
},
{}
{},
)
},
getKeyringAccounts: async () => [...keyringAccounts],
@ -110,7 +110,7 @@ describe('restricted methods', function () {
identities[address] = { lastSelected: index * 1000 }
return identities
},
{}
{},
)
},
getKeyringAccounts: async () => [...keyringAccounts],

@ -67,7 +67,7 @@ describe('Account Menu', function () {
wrapper = mountWithRouter(
<Provider store={store}>
<AccountMenu.WrappedComponent {...props} />
</Provider>, store
</Provider>, store,
)
})

@ -36,5 +36,5 @@ const mapDispatchToProps = (dispatch) => {
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
connect(mapStateToProps, mapDispatchToProps),
)(AppHeader)

@ -32,7 +32,7 @@ describe('App Header', function () {
t: (str) => str,
metricsEvent: () => {},
},
}
},
)
})

@ -43,12 +43,12 @@ const AssetList = ({ onClickAsset }) => {
const [primaryCurrencyDisplay] = useCurrencyDisplay(
selectedAccountBalance,
{ numberOfDecimals: primaryNumberOfDecimals, currency: primaryCurrency }
{ numberOfDecimals: primaryNumberOfDecimals, currency: primaryCurrency },
)
const [secondaryCurrencyDisplay] = useCurrencyDisplay(
selectedAccountBalance,
{ numberOfDecimals: secondaryNumberOfDecimals, currency: secondaryCurrency }
{ numberOfDecimals: secondaryNumberOfDecimals, currency: secondaryCurrency },
)
return (

@ -24,7 +24,7 @@ describe('Confirm Detail Row Component', function () {
onHeaderClick={propsMethodSpies.onHeaderClick}
headerText="mockHeaderText"
headerTextClassName="mockHeaderClass"
/>
/>,
)
})

@ -30,11 +30,11 @@ export default class ConnectedAccountsList extends PureComponent {
shouldRenderListOptions: (props, propName, componentName) => {
if (typeof props[propName] !== 'boolean') {
return new Error(
`Warning: Failed prop type: '${propName}' of component '${componentName}' must be a boolean. Received: ${typeof props[propName]}`
`Warning: Failed prop type: '${propName}' of component '${componentName}' must be a boolean. Received: ${typeof props[propName]}`,
)
} else if (props[propName] && !props['removePermittedAccount']) {
return new Error(
`Warning: Failed prop type: '${propName}' of component '${componentName}' requires prop 'removePermittedAccount'.`
`Warning: Failed prop type: '${propName}' of component '${componentName}' requires prop 'removePermittedAccount'.`,
)
}
},

@ -417,5 +417,5 @@ class NetworkDropdown extends Component {
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
connect(mapStateToProps, mapDispatchToProps),
)(NetworkDropdown)

@ -16,7 +16,7 @@ describe('Dropdown', function () {
style={{ test: 'style' }}
closeMenu={closeMenuSpy}
>
</DropdownMenuItem>
</DropdownMenuItem>,
)
})

@ -8,7 +8,7 @@ describe('Dropdown Menu Components', function () {
describe('Menu', function () {
it('adds prop className to menu', function () {
const wrapper = shallow(
<Menu className="Test Class" isShowing />
<Menu className="Test Class" isShowing />,
)
assert.equal(wrapper.find('.menu').prop('className'), 'menu Test Class')
})
@ -25,7 +25,7 @@ describe('Dropdown Menu Components', function () {
text="test text"
className="test foo1"
onClick={onClickSpy}
/>
/>,
)
})

@ -28,7 +28,7 @@ describe('Network Dropdown', function () {
beforeEach(function () {
wrapper = mountWithRouter(
<NetworkDropdown store={store} />
<NetworkDropdown store={store} />,
)
})

@ -318,7 +318,7 @@ function addHexWEIsToRenderableFiat (aHexWEI, bHexWEI, convertedCurrency, conver
const ethTotal = ethTotalToConvertedCurrency(
addHexWEIsToDec(aHexWEI, bHexWEI),
convertedCurrency,
conversionRate
conversionRate,
)
return formatCurrency(ethTotal, convertedCurrency)
}

@ -223,7 +223,7 @@ describe('GasModalPageContainer Component', function () {
assert.deepEqual(
renderBasicTabContentResult.props.gasPriceButtonGroupProps,
mockGasPriceButtonGroupProps
mockGasPriceButtonGroupProps,
)
})
})
@ -235,7 +235,7 @@ describe('GasModalPageContainer Component', function () {
'mockNewTotalFiat',
' mockNewTotalEth',
' mockSendAmount',
' mockTransactionFee'
' mockTransactionFee',
))
assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName))

@ -84,7 +84,7 @@ describe('GasPriceButtonGroup Component', function () {
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[i]),
mockButtonPropsAndFlags,
i,
]
],
)
}
@ -110,7 +110,7 @@ describe('GasPriceButtonGroup Component', function () {
GasPriceButtonGroup.prototype.renderButtonContent.resetHistory()
const renderButtonResult = GasPriceButtonGroup.prototype.renderButton(
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[0]),
mockButtonPropsAndFlags
mockButtonPropsAndFlags,
)
wrappedRenderButtonResult = shallow(renderButtonResult)
})
@ -125,7 +125,7 @@ describe('GasPriceButtonGroup Component', function () {
assert.equal(mockGasPriceButtonGroupProps.handleGasPriceSelection.callCount, 1)
assert.deepEqual(
mockGasPriceButtonGroupProps.handleGasPriceSelection.getCall(0).args,
[mockGasPriceButtonGroupProps.gasButtonInfo[0].priceInHexWei]
[mockGasPriceButtonGroupProps.gasButtonInfo[0].priceInHexWei],
)
})
@ -152,7 +152,7 @@ describe('GasPriceButtonGroup Component', function () {
showCheck,
className,
},
]
],
)
})
})

@ -176,7 +176,7 @@ export function setSelectedCircle ({
chart.internal.selectPoint(
generateDataUIObj(currentX.toNumber(), numberOfValues, newTimeEstimate),
numberOfValues
numberOfValues,
)
}
@ -322,7 +322,7 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
if (dataToShow.length) {
this.tooltip.html(
this.config.tooltip_contents.call(this, selectedData, this.axis.getXAxisTickFormat(), this.getYFormat(), this.color)
this.config.tooltip_contents.call(this, selectedData, this.axis.getXAxisTickFormat(), this.getYFormat(), this.color),
).style('display', 'flex')
// Get tooltip dimensions

@ -35,7 +35,7 @@ describe('MenuBar', function () {
const wrapper = mountWithRouter(
<Provider store={store}>
<MenuBar />
</Provider>
</Provider>,
)
assert.ok(!wrapper.exists('AccountOptionsMenu'))
const accountOptions = wrapper.find('.menu-bar__account-options')
@ -49,7 +49,7 @@ describe('MenuBar', function () {
const wrapper = mountWithRouter(
<Provider store={store}>
<MenuBar />
</Provider>
</Provider>,
)
const accountOptions = wrapper.find('.menu-bar__account-options')
accountOptions.simulate('click')

@ -8,7 +8,7 @@ describe('ModalContent Component', function () {
const wrapper = shallow(
<ModalContent
title="Modal Title"
/>
/>,
)
assert.equal(wrapper.find('.modal-content__title').length, 1)
@ -20,7 +20,7 @@ describe('ModalContent Component', function () {
const wrapper = shallow(
<ModalContent
description="Modal Description"
/>
/>,
)
assert.equal(wrapper.find('.modal-content__title').length, 0)
@ -33,7 +33,7 @@ describe('ModalContent Component', function () {
<ModalContent
title="Modal Title"
description="Modal Description"
/>
/>,
)
assert.equal(wrapper.find('.modal-content__title').length, 1)

@ -24,7 +24,7 @@ describe('Modal Component', function () {
cancelText="Cancel"
onSubmit={handleSubmit}
submitText="Submit"
/>
/>,
)
const buttons = wrapper.find(Button)
@ -54,7 +54,7 @@ describe('Modal Component', function () {
onSubmit={() => {}}
submitText="Submit"
submitType="confirm"
/>
/>,
)
const buttons = wrapper.find(Button)
@ -72,7 +72,7 @@ describe('Modal Component', function () {
submitText="Submit"
>
<div className="test-child" />
</Modal>
</Modal>,
)
assert.ok(wrapper.find('.test-class'))
@ -89,7 +89,7 @@ describe('Modal Component', function () {
submitText="Submit"
headerText="My Header"
onClose={handleCancel}
/>
/>,
)
assert.ok(wrapper.find('.modal-container__header'))
@ -113,7 +113,7 @@ describe('Modal Component', function () {
submitDisabled
headerText="My Header"
onClose={handleCancel}
/>
/>,
)
const buttons = wrapper.find(Button)

@ -9,7 +9,7 @@ describe('CancelTransactionGasFee Component', function () {
const wrapper = shallow(
<CancelTransactionGasFee
value="0x3b9aca00"
/>
/>,
)
assert.ok(wrapper)

@ -19,7 +19,7 @@ const mapStateToProps = (state, ownProps) => {
toNumericBase: 'hex',
multiplicandBase: 16,
multiplierBase: 10,
})
}),
)
const newGasFee = getHexGasTotal({ gasPrice: defaultNewGasPrice, gasLimit: '0x5208' })

@ -14,7 +14,7 @@ describe('CancelTransaction Component', function () {
<CancelTransaction
newGasFee="0x1319718a5000"
/>,
{ context: { t } }
{ context: { t } },
)
assert.ok(wrapper)
@ -36,7 +36,7 @@ describe('CancelTransaction Component', function () {
hideModal={hideModalSpy}
showTransactionConfirmedModal={() => {}}
/>,
{ context: { t } }
{ context: { t } },
)
assert.equal(wrapper.find(Modal).length, 1)

@ -12,5 +12,5 @@ const mapDispatchToProps = (dispatch) => {
export default compose(
withModalProps,
connect(null, mapDispatchToProps)
connect(null, mapDispatchToProps),
)(ConfirmDeleteNetwork)

@ -20,7 +20,7 @@ describe('Confirm Delete Network', function () {
context: {
t: (str) => str,
},
}
},
)
})

@ -18,5 +18,5 @@ const mapDispatchToProps = (dispatch) => {
export default compose(
withModalProps,
connect(mapStateToProps, mapDispatchToProps)
connect(mapStateToProps, mapDispatchToProps),
)(ConfirmRemoveAccount)

@ -44,7 +44,7 @@ describe('Confirm Remove Account', function () {
t: PropTypes.func,
store: PropTypes.object,
},
}
},
)
})

@ -12,5 +12,5 @@ const mapDispatchToProps = (dispatch) => {
export default compose(
withModalProps,
connect(null, mapDispatchToProps)
connect(null, mapDispatchToProps),
)(ConfirmResetAccount)

@ -18,7 +18,7 @@ describe('Confirm Reset Account', function () {
context: {
t: (str) => str,
},
}
},
)
})

@ -196,7 +196,7 @@ export default class EditApprovalPermission extends PureComponent {
const error = this.validateSpendLimit()
const disabled = Boolean(
(customSpendLimit === customTokenAmount && !selectedOptionIsUnlimited) ||
error
error,
)
return (

@ -14,5 +14,5 @@ const mapStateToProps = (state) => {
export default compose(
withModalProps,
connect(mapStateToProps)
connect(mapStateToProps),
)(EditApprovalPermission)

@ -19,7 +19,7 @@ describe('MetaMetrics Opt In', function () {
context: {
metricsEvent: () => {},
},
}
},
)
})

@ -19,7 +19,7 @@ describe('Reject Transactions Model', function () {
context: {
t: (str) => str,
},
}
},
)
})

@ -41,7 +41,7 @@ describe('Account Details Modal', function () {
context: {
t: (str) => str,
},
}
},
)
})

@ -15,7 +15,7 @@ describe('Transaction Confirmed', function () {
context: {
t: (str) => str,
},
}
},
)
const submit = wrapper.find('.btn-secondary.modal-container__footer-button')
submit.simulate('click')

@ -115,21 +115,21 @@ export default class PermissionPageContainerContent extends PureComponent {
} else if (allIdentitiesSelected) {
return t(
'connectToAll',
[ this.renderAccountTooltip(t('connectToAllAccounts')) ]
[ this.renderAccountTooltip(t('connectToAllAccounts')) ],
)
} else if (selectedIdentities.length > 1) {
return t(
'connectToMultiple',
[
this.renderAccountTooltip(t('connectToMultipleNumberOfAccounts', [ selectedIdentities.length ])),
]
],
)
} else {
return t(
'connectTo',
[
this.getAccountDescriptor(selectedIdentities[0]),
]
],
)
}
}

@ -37,7 +37,7 @@ export default class PermissionPageContainer extends Component {
state = {
selectedPermissions: this.getRequestedMethodState(
this.getRequestedMethodNames(this.props)
this.getRequestedMethodNames(this.props),
),
}
@ -58,7 +58,7 @@ export default class PermissionPageContainer extends Component {
acc[methodName] = true
return acc
},
{}
{},
)
}

@ -75,5 +75,5 @@ function mergeProps (stateProps, dispatchProps, ownProps) {
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps, mergeProps)
connect(mapStateToProps, mapDispatchToProps, mergeProps),
)(SignatureRequestOriginal)

@ -56,7 +56,7 @@ describe('Signature Request', function () {
wrapper = mountWithRouter(
<Provider store={store}>
<SignatureRequest.WrappedComponent {...props} />
</Provider>, store
</Provider>, store,
)
})

@ -55,7 +55,7 @@ describe('Token Cell', function () {
onClick={onClick}
/>
</MemoryRouter>
</Provider>
</Provider>,
)
})

@ -76,7 +76,7 @@ describe('TransactionAction Component', function () {
transaction={transaction}
className="test-class"
/>,
{ context: { t } }
{ context: { t } },
)
assert.ok(wrapper)
@ -110,7 +110,7 @@ describe('TransactionAction Component', function () {
transaction={transaction}
className="test-class"
/>,
{ context: { t } }
{ context: { t } },
)
assert.ok(wrapper)

@ -44,7 +44,7 @@ describe('TransactionActivityLog Component', function () {
onRetry={() => {}}
primaryTransactionStatus="confirmed"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-activity-log'))
@ -92,7 +92,7 @@ describe('TransactionActivityLog Component', function () {
primaryTransactionStatus="pending"
isEarliestNonce
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-activity-log'))
@ -141,7 +141,7 @@ describe('TransactionActivityLog Component', function () {
primaryTransactionStatus="pending"
isEarliestNonce={false}
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-activity-log'))

@ -24,7 +24,7 @@ describe('TransactionBreakdown Component', function () {
transaction={transaction}
className="test-class"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-breakdown'))

@ -13,7 +13,7 @@ describe('TransactionBreakdownRow Component', function () {
>
Test
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
@ -29,7 +29,7 @@ describe('TransactionBreakdownRow Component', function () {
>
<Button onClick={() => {}} >Button</Button>
</TransactionBreakdownRow>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
assert.ok(wrapper.hasClass('transaction-breakdown-row'))

@ -39,7 +39,7 @@ describe('TransactionListItemDetails Component', function () {
senderNickname="sender-nickname"
recipientNickname="recipient-nickname"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
const child = wrapper.childAt(0)
assert.ok(child.hasClass('transaction-list-item-details'))
@ -83,7 +83,7 @@ describe('TransactionListItemDetails Component', function () {
senderNickname="sender-nickname"
recipientNickname="recipient-nickname"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
const child = wrapper.childAt(0)
@ -122,7 +122,7 @@ describe('TransactionListItemDetails Component', function () {
senderNickname="sender-nickname"
recipientNickname="recipient-nickname"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
const child = wrapper.childAt(0)
@ -164,7 +164,7 @@ describe('TransactionListItemDetails Component', function () {
senderNickname="sender-nickname"
recipientNickname="recipient-nickname"
/>,
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
)
const child = wrapper.childAt(0)

@ -47,11 +47,11 @@ export default function TransactionList ({ hideTokenTransactions, tokenAddress }
const pendingTransactions = useMemo(
() => getFilteredTransactionGroups(unfilteredPendingTransactions, hideTokenTransactions, tokenAddress),
[hideTokenTransactions, tokenAddress, unfilteredPendingTransactions]
[hideTokenTransactions, tokenAddress, unfilteredPendingTransactions],
)
const completedTransactions = useMemo(
() => getFilteredTransactionGroups(unfilteredCompletedTransactions, hideTokenTransactions, tokenAddress),
[hideTokenTransactions, tokenAddress, unfilteredCompletedTransactions]
[hideTokenTransactions, tokenAddress, unfilteredCompletedTransactions],
)
const { fetchGasEstimates, fetchBasicGasAndTimeEstimates } = useMemo(() => ({

@ -16,7 +16,7 @@ describe('TransactionStatus Component', function () {
<TransactionStatus
status="confirmed"
date="June 1"
/>
/>,
)
assert.ok(wrapper)
@ -29,7 +29,7 @@ describe('TransactionStatus Component', function () {
status="approved"
isEarliestNonce
error={{ message: 'test-title' }}
/>
/>,
)
assert.ok(wrapper)
@ -43,7 +43,7 @@ describe('TransactionStatus Component', function () {
date="June 1"
status="submitted"
isEarliestNonce
/>
/>,
)
assert.ok(wrapper)
@ -54,7 +54,7 @@ describe('TransactionStatus Component', function () {
const wrapper = mount(
<TransactionStatus
status="queued"
/>
/>,
)
assert.ok(wrapper)
@ -66,7 +66,7 @@ describe('TransactionStatus Component', function () {
const wrapper = mount(
<TransactionStatus
status="unapproved"
/>
/>,
)
assert.ok(wrapper)

@ -16,7 +16,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
})
it('should render properly', function () {
const wrapper = shallow(
<UserPreferencedCurrencyDisplay />
<UserPreferencedCurrencyDisplay />,
)
assert.ok(wrapper)
@ -29,7 +29,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
prop1
prop2="test"
prop3={1}
/>
/>,
)
assert.ok(wrapper)

@ -8,7 +8,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
describe('rendering', function () {
it('should render properly', function () {
const wrapper = shallow(
<UserPreferencedCurrencyInput />
<UserPreferencedCurrencyInput />,
)
assert.ok(wrapper)
@ -19,7 +19,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
const wrapper = shallow(
<UserPreferencedCurrencyInput
useNativeCurrencyAsPrimaryCurrency
/>
/>,
)
assert.ok(wrapper)

@ -8,7 +8,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
describe('rendering', function () {
it('should render properly', function () {
const wrapper = shallow(
<UserPreferencedTokenInput token={{ address: '0x0' }} />
<UserPreferencedTokenInput token={{ address: '0x0' }} />,
)
assert.ok(wrapper)
@ -20,7 +20,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
<UserPreferencedTokenInput
token={{ address: '0x0' }}
useNativeCurrencyAsPrimaryCurrency
/>
/>,
)
assert.ok(wrapper)

@ -14,7 +14,7 @@ describe('AccountMismatchWarning', function () {
return { address: 'mockedAddress' }
}
throw new Error(
`${selector.name} is not cared for in the AccountMismatchWarning test useSelector stub`
`${selector.name} is not cared for in the AccountMismatchWarning test useSelector stub`,
)
})
})

@ -9,7 +9,7 @@ describe('Alert', function () {
beforeEach(function () {
wrapper = shallow(
<Alert />
<Alert />,
)
})

@ -9,7 +9,7 @@ describe('Breadcrumbs Component', function () {
<Breadcrumbs
currentIndex={1}
total={3}
/>
/>,
)
assert.ok(wrapper)

@ -33,7 +33,7 @@ const Button = ({ type, submit, large, children, icon, rounded, className, ...bu
typeHash[type] || CLASSNAME_DEFAULT,
large && CLASSNAME_LARGE,
rounded && CLASSNAME_ROUNDED,
className
className,
)}
{ ...buttonProps }
>

@ -11,7 +11,7 @@ describe('Card Component', function () {
className="card-test-class"
>
<div className="child-test-class">Child</div>
</Card>
</Card>,
)
assert.ok(wrapper.hasClass('card-test-class'))

@ -13,7 +13,7 @@ describe('CurrencyInput Component', function () {
describe('rendering', function () {
it('should render properly without a suffix', function () {
const wrapper = shallow(
<CurrencyInput />
<CurrencyInput />,
)
assert.ok(wrapper)
@ -37,7 +37,7 @@ describe('CurrencyInput Component', function () {
fiatSuffix="USD"
nativeCurrency="ETH"
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -66,7 +66,7 @@ describe('CurrencyInput Component', function () {
currentCurrency="usd"
conversionRate={231.06}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -100,7 +100,7 @@ describe('CurrencyInput Component', function () {
currentCurrency="usd"
conversionRate={231.06}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -139,7 +139,7 @@ describe('CurrencyInput Component', function () {
{
context: { t: (str) => str + '_t' },
childContextTypes: { t: PropTypes.func },
}
},
)
assert.ok(wrapper)
@ -180,7 +180,7 @@ describe('CurrencyInput Component', function () {
currentCurrency="usd"
conversionRate={231.06}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -221,7 +221,7 @@ describe('CurrencyInput Component', function () {
conversionRate={231.06}
useFiat
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -262,7 +262,7 @@ describe('CurrencyInput Component', function () {
conversionRate={231.06}
useFiat
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -297,7 +297,7 @@ describe('CurrencyInput Component', function () {
currentCurrency="usd"
conversionRate={231.06}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)

@ -46,7 +46,7 @@ Dropdown.propTypes = {
PropTypes.exact({
name: PropTypes.string,
value: PropTypes.string.isRequired,
})
}),
).isRequired,
selectedOption: PropTypes.string,
style: PropTypes.object,

@ -31,7 +31,7 @@ export const simple = () => (
select(
'Selected Option',
namedOptions.map((option) => option.value),
namedOptions[0].value
namedOptions[0].value,
)
}
/>
@ -48,7 +48,7 @@ export const optionsWithoutNames = () => (
select(
'Selected Option',
unnamedOptions.map((option) => option.value),
unnamedOptions[0].value
unnamedOptions[0].value,
)
}
/>
@ -65,7 +65,7 @@ export const optionsWithLongNames = () => (
select(
'Selected Option',
namedOptionsWithVeryLongNames.map((option) => option.value),
namedOptionsWithVeryLongNames[0].value
namedOptionsWithVeryLongNames[0].value,
)
}
/>
@ -82,7 +82,7 @@ export const optionsWithLongNamesAndShortWidth = () => (
select(
'Selected Option',
namedOptionsWithVeryLongNames.map((option) => option.value),
namedOptionsWithVeryLongNames[0].value
namedOptionsWithVeryLongNames[0].value,
)
}
style={{ width: '200px' }}

@ -11,7 +11,7 @@ describe('ErrorMessage Component', function () {
<ErrorMessage
errorMessage="This is an error."
/>,
{ context: { t } }
{ context: { t } },
)
assert.ok(wrapper)
@ -25,7 +25,7 @@ describe('ErrorMessage Component', function () {
<ErrorMessage
errorKey="testKey"
/>,
{ context: { t } }
{ context: { t } },
)
assert.ok(wrapper)

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

@ -31,7 +31,7 @@ describe('ListItem', function () {
onClick={clickHandler}
>
{CHILDREN}
</ListItem>
</ListItem>,
)
})
it('includes the data-testid', function () {

@ -22,7 +22,7 @@ const Menu = ({ anchorElement, children, className, onHide, popperOptions }) =>
{ children }
</div>
</>,
popoverContainerElement.current
popoverContainerElement.current,
)
}

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

@ -32,7 +32,7 @@ describe('Page Footer', function () {
<PageFooter>
<div>Works</div>
</PageFooter>,
{ context: { t: sinon.spy((k) => `[${k}]`) } }
{ context: { t: sinon.spy((k) => `[${k}]`) } },
)
assert.equal(wrapper.find('.page-container__footer-secondary').length, 1)

@ -99,7 +99,7 @@ describe('TokenInput Component', function () {
}}
tokenExchangeRates={{ '0x1': 2 }}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -133,7 +133,7 @@ describe('TokenInput Component', function () {
tokenExchangeRates={{ '0x1': 2 }}
showFiat
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -216,7 +216,7 @@ describe('TokenInput Component', function () {
}}
tokenExchangeRates={{ '0x1': 2 }}
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -258,7 +258,7 @@ describe('TokenInput Component', function () {
tokenExchangeRates={{ '0x1': 2 }}
showFiat
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)
@ -300,7 +300,7 @@ describe('TokenInput Component', function () {
tokenExchangeRates={{ '0x1': 2 }}
showFiat
/>
</Provider>
</Provider>,
)
assert.ok(wrapper)

@ -8,7 +8,7 @@ describe('UnitInput Component', function () {
describe('rendering', function () {
it('should render properly without a suffix', function () {
const wrapper = shallow(
<UnitInput />
<UnitInput />,
)
assert.ok(wrapper)
@ -19,7 +19,7 @@ describe('UnitInput Component', function () {
const wrapper = shallow(
<UnitInput
suffix="ETH"
/>
/>,
)
assert.ok(wrapper)
@ -33,7 +33,7 @@ describe('UnitInput Component', function () {
<div className="testing">
TESTCOMPONENT
</div>
</UnitInput>
</UnitInput>,
)
assert.ok(wrapper)
@ -45,7 +45,7 @@ describe('UnitInput Component', function () {
const wrapper = shallow(
<UnitInput
error
/>
/>,
)
assert.ok(wrapper)
@ -64,7 +64,7 @@ describe('UnitInput Component', function () {
it('should focus the input on component click', function () {
const wrapper = mount(
<UnitInput />
<UnitInput />,
)
assert.ok(wrapper)
@ -80,7 +80,7 @@ describe('UnitInput Component', function () {
const wrapper = mount(
<UnitInput
onChange={handleChangeSpy}
/>
/>,
)
assert.ok(wrapper)
@ -96,7 +96,7 @@ describe('UnitInput Component', function () {
const wrapper = mount(
<UnitInput
value={123}
/>
/>,
)
assert.ok(wrapper)
@ -107,7 +107,7 @@ describe('UnitInput Component', function () {
const wrapper = mount(
<UnitInput
onChange={handleChangeSpy}
/>
/>,
)
assert.ok(wrapper)

@ -23,7 +23,7 @@ import {
export const MetaMetricsContext = createContext(() => {
captureException(
Error(`MetaMetrics context function was called from a react node that is not a descendant of a MetaMetrics context provider`)
Error(`MetaMetrics context function was called from a react node that is not a descendant of a MetaMetrics context provider`),
)
})

@ -101,7 +101,7 @@ describe('Confirm Transaction Duck', function () {
...mockState.txData,
id: 2,
},
}
},
)
})
@ -113,7 +113,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
txData: {},
}
},
)
})
@ -131,7 +131,7 @@ describe('Confirm Transaction Duck', function () {
...mockState.tokenData,
name: 'defToken',
},
}
},
)
})
@ -143,7 +143,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
tokenData: {},
}
},
)
})
@ -161,7 +161,7 @@ describe('Confirm Transaction Duck', function () {
...mockState.methodData,
name: 'transferFrom',
},
}
},
)
})
@ -173,7 +173,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
methodData: {},
}
},
)
})
@ -192,7 +192,7 @@ describe('Confirm Transaction Duck', function () {
fiatTransactionAmount: '123.45',
ethTransactionAmount: '.5',
hexTransactionAmount: '0x1',
}
},
)
})
@ -211,7 +211,7 @@ describe('Confirm Transaction Duck', function () {
fiatTransactionFee: '123.45',
ethTransactionFee: '.5',
hexTransactionFee: '0x1',
}
},
)
})
@ -230,7 +230,7 @@ describe('Confirm Transaction Duck', function () {
fiatTransactionTotal: '123.45',
ethTransactionTotal: '.5',
hexTransactionTotal: '0x1',
}
},
)
})
@ -249,7 +249,7 @@ describe('Confirm Transaction Duck', function () {
tokenSymbol: 'DEF',
tokenDecimals: '1',
},
}
},
)
})
@ -262,7 +262,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
nonce: '0x1',
}
},
)
})
@ -275,7 +275,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
toSmartContract: true,
}
},
)
})
@ -287,7 +287,7 @@ describe('Confirm Transaction Duck', function () {
{
...mockState,
fetchingData: true,
}
},
)
})
@ -313,7 +313,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTxData(txData),
expectedAction
expectedAction,
)
})
@ -324,7 +324,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.clearTxData(),
expectedAction
expectedAction,
)
})
@ -337,7 +337,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTokenData(tokenData),
expectedAction
expectedAction,
)
})
@ -348,7 +348,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.clearTokenData(),
expectedAction
expectedAction,
)
})
@ -361,7 +361,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateMethodData(methodData),
expectedAction
expectedAction,
)
})
@ -372,7 +372,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.clearMethodData(),
expectedAction
expectedAction,
)
})
@ -385,7 +385,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTransactionAmounts(transactionAmounts),
expectedAction
expectedAction,
)
})
@ -398,7 +398,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTransactionFees(transactionFees),
expectedAction
expectedAction,
)
})
@ -411,7 +411,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTransactionTotals(transactionTotals),
expectedAction
expectedAction,
)
})
@ -427,7 +427,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateTokenProps(tokenProps),
expectedAction
expectedAction,
)
})
@ -440,7 +440,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.updateNonce(nonce),
expectedAction
expectedAction,
)
})
@ -451,7 +451,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.setFetchingData(true),
expectedAction
expectedAction,
)
})
@ -462,7 +462,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.setFetchingData(false),
expectedAction
expectedAction,
)
})
@ -473,7 +473,7 @@ describe('Confirm Transaction Duck', function () {
assert.deepEqual(
actions.clearConfirmTransaction(),
expectedAction
expectedAction,
)
})
})
@ -482,7 +482,7 @@ describe('Confirm Transaction Duck', function () {
beforeEach(function () {
global.eth = {
getCode: sinon.stub().callsFake(
(address) => Promise.resolve(address && address.match(/isContract/) ? 'not-0x' : '0x')
(address) => Promise.resolve(address && address.match(/isContract/) ? 'not-0x' : '0x'),
),
}
})

@ -168,7 +168,7 @@ describe('Gas Duck', function () {
it('should set gasEstimatesLoading to true when receiving a GAS_ESTIMATE_LOADING_STARTED action', function () {
assert.deepEqual(
GasReducer(mockState, { type: GAS_ESTIMATE_LOADING_STARTED }),
{ gasEstimatesLoading: true, ...mockState }
{ gasEstimatesLoading: true, ...mockState },
)
})
@ -288,7 +288,7 @@ describe('Gas Duck', function () {
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
@ -296,7 +296,7 @@ describe('Gas Duck', function () {
)
assert.deepEqual(
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,
@ -310,11 +310,11 @@ describe('Gas Duck', function () {
fastest: 4,
safeLow: 1,
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(3).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
@ -337,11 +337,11 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{}
{},
) }))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(window.fetch.notCalled)
assert.deepEqual(
@ -356,11 +356,11 @@ describe('Gas Duck', function () {
fastest: 45,
safeLow: 15,
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(2).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
@ -373,11 +373,11 @@ describe('Gas Duck', function () {
await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{}
{},
) }))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
@ -385,7 +385,7 @@ describe('Gas Duck', function () {
)
assert.deepEqual(
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,
@ -399,11 +399,11 @@ describe('Gas Duck', function () {
fastest: 4,
safeLow: 1,
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(3).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
})
@ -415,13 +415,13 @@ describe('Gas Duck', function () {
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{ basicPriceAndTimeEstimatesLastRetrieved: 1000000 }
{ basicPriceAndTimeEstimatesLastRetrieved: 1000000 },
),
metamask: { provider: { type: 'ropsten' } },
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
@ -430,7 +430,7 @@ describe('Gas Duck', function () {
assert.deepEqual(
mockDistpatch.getCall(1).args,
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
)
assert.deepEqual(
@ -450,11 +450,11 @@ describe('Gas Duck', function () {
safeLowWait: 'mockSafeLowWait',
speed: 'mockSpeed',
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(3).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
@ -482,13 +482,13 @@ describe('Gas Duck', function () {
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{}
{},
),
metamask: { provider: { type: 'ropsten' } },
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(window.fetch.notCalled)
@ -509,11 +509,11 @@ describe('Gas Duck', function () {
safeLowWait: 'mockSafeLowWait',
speed: 'mockSpeed',
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(2).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
@ -526,13 +526,13 @@ describe('Gas Duck', function () {
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{}
{},
),
metamask: { provider: { type: 'ropsten' } },
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
@ -541,7 +541,7 @@ describe('Gas Duck', function () {
assert.deepEqual(
mockDistpatch.getCall(1).args,
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
)
assert.deepEqual(
@ -561,11 +561,11 @@ describe('Gas Duck', function () {
safeLowWait: 'mockSafeLowWait',
speed: 'mockSpeed',
},
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(3).args,
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: BASIC_GAS_ESTIMATE_LOADING_FINISHED }],
)
})
})
@ -577,13 +577,13 @@ describe('Gas Duck', function () {
await fetchGasEstimates(5)(mockDistpatch, () => ({ gas: Object.assign(
{},
initState,
{ priceAndTimeEstimatesLastRetrieved: 1000000 }
{ priceAndTimeEstimatesLastRetrieved: 1000000 },
),
metamask: { provider: { type: 'ropsten' } },
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.ok(
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/predictTable.json'),
@ -592,7 +592,7 @@ describe('Gas Duck', function () {
assert.deepEqual(
mockDistpatch.getCall(1).args,
[{ type: SET_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 }]
[{ type: SET_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 }],
)
const { type: thirdDispatchCallType, value: priceAndTimeEstimateResult } = mockDistpatch.getCall(2).args[0]
@ -604,7 +604,7 @@ describe('Gas Duck', function () {
assert.deepEqual(
mockDistpatch.getCall(3).args,
[{ type: GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: GAS_ESTIMATE_LOADING_FINISHED }],
)
})
@ -621,13 +621,13 @@ describe('Gas Duck', function () {
expectedWait: 2,
gasprice: 50,
}],
}
},
),
metamask: { provider: { type: 'ropsten' } },
}))
assert.deepEqual(
mockDistpatch.getCall(0).args,
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
[{ type: GAS_ESTIMATE_LOADING_STARTED } ],
)
assert.equal(window.fetch.callCount, 0)
@ -643,11 +643,11 @@ describe('Gas Duck', function () {
},
],
}]
}],
)
assert.deepEqual(
mockDistpatch.getCall(2).args,
[{ type: GAS_ESTIMATE_LOADING_FINISHED }]
[{ type: GAS_ESTIMATE_LOADING_FINISHED }],
)
})
})
@ -656,7 +656,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
gasEstimatesLoadingStarted(),
{ type: GAS_ESTIMATE_LOADING_STARTED }
{ type: GAS_ESTIMATE_LOADING_STARTED },
)
})
})
@ -665,7 +665,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
gasEstimatesLoadingFinished(),
{ type: GAS_ESTIMATE_LOADING_FINISHED }
{ type: GAS_ESTIMATE_LOADING_FINISHED },
)
})
})
@ -674,7 +674,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setPricesAndTimeEstimates('mockPricesAndTimeEstimates'),
{ type: SET_PRICE_AND_TIME_ESTIMATES, value: 'mockPricesAndTimeEstimates' }
{ type: SET_PRICE_AND_TIME_ESTIMATES, value: 'mockPricesAndTimeEstimates' },
)
})
})
@ -683,7 +683,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setBasicGasEstimateData('mockBasicEstimatData'),
{ type: SET_BASIC_GAS_ESTIMATE_DATA, value: 'mockBasicEstimatData' }
{ type: SET_BASIC_GAS_ESTIMATE_DATA, value: 'mockBasicEstimatData' },
)
})
})
@ -692,7 +692,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setCustomGasPrice('mockCustomGasPrice'),
{ type: SET_CUSTOM_GAS_PRICE, value: 'mockCustomGasPrice' }
{ type: SET_CUSTOM_GAS_PRICE, value: 'mockCustomGasPrice' },
)
})
})
@ -701,7 +701,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setCustomGasLimit('mockCustomGasLimit'),
{ type: SET_CUSTOM_GAS_LIMIT, value: 'mockCustomGasLimit' }
{ type: SET_CUSTOM_GAS_LIMIT, value: 'mockCustomGasLimit' },
)
})
})
@ -710,7 +710,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setCustomGasTotal('mockCustomGasTotal'),
{ type: SET_CUSTOM_GAS_TOTAL, value: 'mockCustomGasTotal' }
{ type: SET_CUSTOM_GAS_TOTAL, value: 'mockCustomGasTotal' },
)
})
})
@ -719,7 +719,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setCustomGasErrors('mockErrorObject'),
{ type: SET_CUSTOM_GAS_ERRORS, value: 'mockErrorObject' }
{ type: SET_CUSTOM_GAS_ERRORS, value: 'mockErrorObject' },
)
})
})
@ -728,7 +728,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
setApiEstimatesLastRetrieved(1234),
{ type: SET_API_ESTIMATES_LAST_RETRIEVED, value: 1234 }
{ type: SET_API_ESTIMATES_LAST_RETRIEVED, value: 1234 },
)
})
})
@ -737,7 +737,7 @@ describe('Gas Duck', function () {
it('should create the correct action', function () {
assert.deepEqual(
resetCustomGasState(),
{ type: RESET_CUSTOM_GAS_STATE }
{ type: RESET_CUSTOM_GAS_STATE },
)
})
})

@ -194,7 +194,7 @@ async function queryEthGasStationPredictionTable () {
'referrerPolicy': 'no-referrer-when-downgrade',
'body': null,
'method': 'GET',
'mode': 'cors' }
'mode': 'cors' },
)
}
@ -441,7 +441,7 @@ export function fetchGasEstimates (blockTime) {
})
: Promise.resolve(priceAndTimeEstimates.length
? priceAndTimeEstimates
: loadLocalStorageData('GAS_API_ESTIMATES')
: loadLocalStorageData('GAS_API_ESTIMATES'),
)
return promiseToFetch.then((estimates) => {

@ -27,7 +27,7 @@ describe('withModalProps', function () {
const WrappedComponent = withModalProps(TestComponent)
const store = configureMockStore()(mockState)
const wrapper = mount(
<WrappedComponent store={store} />
<WrappedComponent store={store} />,
)
assert.ok(wrapper)

@ -18,28 +18,28 @@ describe('Confirm Transaction utils', function () {
it('should return true if the first value is greater than the second value', function () {
assert.equal(
utils.hexGreaterThan('0xb', '0xa'),
true
true,
)
})
it('should return false if the first value is less than the second value', function () {
assert.equal(
utils.hexGreaterThan('0xa', '0xb'),
false
false,
)
})
it('should return false if the first value is equal to the second value', function () {
assert.equal(
utils.hexGreaterThan('0xa', '0xa'),
false
false,
)
})
it('should correctly compare prefixed and non-prefixed hex values', function () {
assert.equal(
utils.hexGreaterThan('0xb', 'a'),
true
true,
)
})
})
@ -48,14 +48,14 @@ describe('Confirm Transaction utils', function () {
it('should multiply the hex gasLimit and hex gasPrice values together', function () {
assert.equal(
utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }),
'0x1319718a5000'
'0x1319718a5000',
)
})
it('should prefix the result with 0x', function () {
assert.equal(
utils.getHexGasTotal({ gasLimit: '5208', gasPrice: '3b9aca00' }),
'0x1319718a5000'
'0x1319718a5000',
)
})
})
@ -64,14 +64,14 @@ describe('Confirm Transaction utils', function () {
it('should add two values together rounding to 6 decimal places', function () {
assert.equal(
utils.addEth('0.12345678', '0'),
'0.123457'
'0.123457',
)
})
it('should add any number of values together rounding to 6 decimal places', function () {
assert.equal(
utils.addEth('0.1', '0.02', '0.003', '0.0004', '0.00005', '0.000006', '0.0000007'),
'0.123457'
'0.123457',
)
})
})
@ -80,14 +80,14 @@ describe('Confirm Transaction utils', function () {
it('should add two values together rounding to 2 decimal places', function () {
assert.equal(
utils.addFiat('0.12345678', '0'),
'0.12'
'0.12',
)
})
it('should add any number of values together rounding to 2 decimal places', function () {
assert.equal(
utils.addFiat('0.1', '0.02', '0.003', '0.0004', '0.00005', '0.000006', '0.0000007'),
'0.12'
'0.12',
)
})
})

@ -222,7 +222,7 @@ const conversionMax = (
) => {
const firstIsGreater = conversionGreaterThan(
{ ...firstProps },
{ ...secondProps }
{ ...secondProps },
)
return firstIsGreater ? firstProps.value : secondProps.value

@ -160,7 +160,7 @@ export function getFormattedTokenFiatAmount (
conversionRate,
currentCurrency,
tokenAmount,
tokenSymbol
tokenSymbol,
) {
// If the conversionRate is 0 (i.e. unknown) or the contract exchange rate
// is currently unknown, the fiat amount cannot be calculated so it is not
@ -171,7 +171,7 @@ export function getFormattedTokenFiatAmount (
const currentTokenToFiatRate = multiplyCurrencies(
contractExchangeRate,
conversionRate
conversionRate,
)
const currentTokenInFiat = conversionUtil(tokenAmount, {
fromNumericBase: 'dec',

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

Loading…
Cancel
Save