mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
parent
07237e3dbf
commit
4f0a205369
@ -260,7 +260,7 @@ function setupController (initState, initLangCode) {
|
|||||||
createStreamSink(persistData),
|
createStreamSink(persistData),
|
||||||
(error) => {
|
(error) => {
|
||||||
log.error('MetaMask - Persistence pipeline failed', error)
|
log.error('MetaMask - Persistence pipeline failed', error)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -454,7 +454,7 @@ async function openPopup () {
|
|||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,13 +77,13 @@ async function setupStreams () {
|
|||||||
pageMux,
|
pageMux,
|
||||||
pageStream,
|
pageStream,
|
||||||
pageMux,
|
pageMux,
|
||||||
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err)
|
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err),
|
||||||
)
|
)
|
||||||
pump(
|
pump(
|
||||||
extensionMux,
|
extensionMux,
|
||||||
extensionStream,
|
extensionStream,
|
||||||
extensionMux,
|
extensionMux,
|
||||||
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err)
|
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err),
|
||||||
)
|
)
|
||||||
|
|
||||||
// forward communication across inpage-background for these channels only
|
// forward communication across inpage-background for these channels only
|
||||||
@ -102,7 +102,7 @@ function forwardTrafficBetweenMuxers (channelName, muxA, muxB) {
|
|||||||
channelA,
|
channelA,
|
||||||
channelB,
|
channelB,
|
||||||
channelA,
|
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
|
alertEnabledness[alertType] = true
|
||||||
return alertEnabledness
|
return alertEnabledness
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
),
|
),
|
||||||
unconnectedAccountAlertShownOrigins: {},
|
unconnectedAccountAlertShownOrigins: {},
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ export default class AlertController {
|
|||||||
initState,
|
initState,
|
||||||
{
|
{
|
||||||
unconnectedAccountAlertShownOrigins: {},
|
unconnectedAccountAlertShownOrigins: {},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
this.store = new ObservableStore(state)
|
this.store = new ObservableStore(state)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export class PermissionsController {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
engine.push(this.permissions.providerMiddlewareFunction.bind(
|
engine.push(this.permissions.providerMiddlewareFunction.bind(
|
||||||
this.permissions, { origin }
|
this.permissions, { origin },
|
||||||
))
|
))
|
||||||
|
|
||||||
return asMiddleware(engine)
|
return asMiddleware(engine)
|
||||||
@ -132,7 +132,7 @@ export class PermissionsController {
|
|||||||
const req = { method: 'eth_accounts' }
|
const req = { method: 'eth_accounts' }
|
||||||
const res = {}
|
const res = {}
|
||||||
this.permissions.providerMiddlewareFunction(
|
this.permissions.providerMiddlewareFunction(
|
||||||
{ origin }, req, res, () => {}, _end
|
{ origin }, req, res, () => {}, _end,
|
||||||
)
|
)
|
||||||
|
|
||||||
function _end () {
|
function _end () {
|
||||||
@ -187,7 +187,7 @@ export class PermissionsController {
|
|||||||
const res = {}
|
const res = {}
|
||||||
|
|
||||||
this.permissions.providerMiddlewareFunction(
|
this.permissions.providerMiddlewareFunction(
|
||||||
domain, req, res, () => {}, _end
|
domain, req, res, () => {}, _end,
|
||||||
)
|
)
|
||||||
|
|
||||||
function _end (_err) {
|
function _end (_err) {
|
||||||
@ -233,7 +233,7 @@ export class PermissionsController {
|
|||||||
// attempt to finalize the request and resolve it,
|
// attempt to finalize the request and resolve it,
|
||||||
// settings caveats as necessary
|
// settings caveats as necessary
|
||||||
approved.permissions = await this.finalizePermissionsRequest(
|
approved.permissions = await this.finalizePermissionsRequest(
|
||||||
approved.permissions, accounts
|
approved.permissions, accounts,
|
||||||
)
|
)
|
||||||
approval.resolve(approved.permissions)
|
approval.resolve(approved.permissions)
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ export class PermissionsController {
|
|||||||
this.permissions.updateCaveatFor(
|
this.permissions.updateCaveatFor(
|
||||||
origin, 'eth_accounts',
|
origin, 'eth_accounts',
|
||||||
CAVEAT_NAMES.exposedAccounts,
|
CAVEAT_NAMES.exposedAccounts,
|
||||||
[...oldPermittedAccounts, account]
|
[...oldPermittedAccounts, account],
|
||||||
)
|
)
|
||||||
|
|
||||||
const permittedAccounts = await this.getAccounts(origin)
|
const permittedAccounts = await this.getAccounts(origin)
|
||||||
@ -459,7 +459,7 @@ export class PermissionsController {
|
|||||||
// update "last seen" time for the origin and account(s)
|
// update "last seen" time for the origin and account(s)
|
||||||
// exception: no accounts -> no times to update
|
// exception: no accounts -> no times to update
|
||||||
this.permissionsLog.updateAccountsHistory(
|
this.permissionsLog.updateAccountsHistory(
|
||||||
origin, newAccounts
|
origin, newAccounts,
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTE:
|
// NOTE:
|
||||||
@ -490,7 +490,7 @@ export class PermissionsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return { parentCapability: methodName }
|
return { parentCapability: methodName }
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -642,8 +642,8 @@ export class PermissionsController {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
connectedDomains
|
connectedDomains
|
||||||
.map(
|
.map(
|
||||||
(origin) => this._handleConnectedAccountSelected(origin)
|
(origin) => this._handleConnectedAccountSelected(origin),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ export class PermissionsController {
|
|||||||
this.pendingApprovals.has(id)
|
this.pendingApprovals.has(id)
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
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)) {
|
if (this.pendingApprovalOrigins.has(origin)) {
|
||||||
throw ethErrors.rpc.resourceUnavailable(
|
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) {
|
if (isProcessingRequestAccounts) {
|
||||||
res.error = ethErrors.rpc.resourceUnavailable(
|
res.error = ethErrors.rpc.resourceUnavailable(
|
||||||
'Already processing eth_requestAccounts. Please wait.'
|
'Already processing eth_requestAccounts. Please wait.',
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ export default function createMethodMiddleware ({
|
|||||||
// this should never happen, because it should be caught in the
|
// this should never happen, because it should be caught in the
|
||||||
// above catch clause
|
// above catch clause
|
||||||
res.error = ethErrors.rpc.internal(
|
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 (
|
logPermissionsHistory (
|
||||||
requestedMethods, origin, result,
|
requestedMethods, origin, result,
|
||||||
time, isEthRequestAccounts
|
time, isEthRequestAccounts,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
let accounts, newEntries
|
let accounts, newEntries
|
||||||
@ -378,6 +378,6 @@ export default class PermissionsLogController {
|
|||||||
*/
|
*/
|
||||||
function getAccountToTimeMap (accounts, time) {
|
function getAccountToTimeMap (accounts, time) {
|
||||||
return accounts.reduce(
|
return accounts.reduce(
|
||||||
(acc, account) => ({ ...acc, [account]: time }), {}
|
(acc, account) => ({ ...acc, [account]: time }), {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export default function getRestrictedMethods ({ getIdentities, getKeyringAccount
|
|||||||
(err) => {
|
(err) => {
|
||||||
res.error = err
|
res.error = err
|
||||||
end(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
|
// 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
|
// 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
|
// 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(
|
const getPreferredLocales = extension.i18n ? promisify(
|
||||||
extension.i18n.getAcceptLanguages,
|
extension.i18n.getAcceptLanguages,
|
||||||
{ errorFirst: false }
|
{ errorFirst: false },
|
||||||
) : async () => []
|
) : async () => []
|
||||||
|
|
||||||
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)
|
// 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) {
|
if (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
return mux
|
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('from' in params, 'Params must include a "from" field.')
|
||||||
assert.ok(
|
assert.ok(
|
||||||
typeof params.from === 'string' && isValidAddress(params.from),
|
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) {
|
switch (params.version) {
|
||||||
|
@ -273,7 +273,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
if (error) {
|
if (error) {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -717,7 +717,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
const tokenAddress = ethUtil.toChecksumAddress(address)
|
const tokenAddress = ethUtil.toChecksumAddress(address)
|
||||||
return contractMap[tokenAddress] ? contractMap[tokenAddress].erc20 : true
|
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 simpleKeyPairKeyrings = this.keyringController.getKeyringsByType('Simple Key Pair')
|
||||||
const hdAccounts = await hdKeyring.getAccounts()
|
const hdAccounts = await hdKeyring.getAccounts()
|
||||||
const simpleKeyPairKeyringAccounts = await Promise.all(
|
const simpleKeyPairKeyringAccounts = await Promise.all(
|
||||||
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts())
|
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts()),
|
||||||
)
|
)
|
||||||
const simpleKeyPairAccounts = simpleKeyPairKeyringAccounts.reduce((acc, accounts) => [...acc, ...accounts], [])
|
const simpleKeyPairAccounts = simpleKeyPairKeyringAccounts.reduce((acc, accounts) => [...acc, ...accounts], [])
|
||||||
const accounts = {
|
const accounts = {
|
||||||
@ -1523,7 +1523,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
if (err) {
|
if (err) {
|
||||||
log.error(err)
|
log.error(err)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
dnode.on('remote', (remote) => {
|
dnode.on('remote', (remote) => {
|
||||||
// push updates to popup
|
// push updates to popup
|
||||||
@ -1575,7 +1575,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
if (err) {
|
if (err) {
|
||||||
log.error(err)
|
log.error(err)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1650,7 +1650,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
if (err) {
|
if (err) {
|
||||||
log.error(err)
|
log.error(err)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ function setupTaskDisplay (taskEvents) {
|
|||||||
|
|
||||||
function displayChart (data) {
|
function displayChart (data) {
|
||||||
// sort tasks by start time
|
// sort tasks by start time
|
||||||
data.sort((a, b,) => a[1] - b[1])
|
data.sort((a, b) => a[1] - b[1])
|
||||||
|
|
||||||
// get bounds
|
// get bounds
|
||||||
const first = Math.min(...data.map((entry) => entry[1]))
|
const first = Math.min(...data.map((entry) => entry[1]))
|
||||||
|
@ -25,7 +25,7 @@ function createEtcTasks ({ browserPlatforms, livereload }) {
|
|||||||
|
|
||||||
// zip tasks for distribution
|
// zip tasks for distribution
|
||||||
const zip = createTask('zip', composeParallel(
|
const zip = createTask('zip', composeParallel(
|
||||||
...browserPlatforms.map((platform) => createZipTask(platform))
|
...browserPlatforms.map((platform) => createZipTask(platform)),
|
||||||
))
|
))
|
||||||
|
|
||||||
return { clean, reload, zip }
|
return { clean, reload, zip }
|
||||||
|
@ -39,9 +39,9 @@ function defineAllTasks () {
|
|||||||
scriptTasks.dev,
|
scriptTasks.dev,
|
||||||
staticTasks.dev,
|
staticTasks.dev,
|
||||||
manifestTasks.dev,
|
manifestTasks.dev,
|
||||||
reload
|
reload,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// build for test development (livereload)
|
// build for test development (livereload)
|
||||||
@ -53,9 +53,9 @@ function defineAllTasks () {
|
|||||||
scriptTasks.testDev,
|
scriptTasks.testDev,
|
||||||
staticTasks.dev,
|
staticTasks.dev,
|
||||||
manifestTasks.testDev,
|
manifestTasks.testDev,
|
||||||
reload
|
reload,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// build for prod release
|
// build for prod release
|
||||||
@ -69,7 +69,7 @@ function defineAllTasks () {
|
|||||||
manifestTasks.prod,
|
manifestTasks.prod,
|
||||||
),
|
),
|
||||||
zip,
|
zip,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// build for CI testing
|
// build for CI testing
|
||||||
@ -82,7 +82,7 @@ function defineAllTasks () {
|
|||||||
staticTasks.prod,
|
staticTasks.prod,
|
||||||
manifestTasks.test,
|
manifestTasks.test,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
// special build for minimal CI testing
|
// special build for minimal CI testing
|
||||||
|
@ -94,13 +94,13 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
|
|||||||
|
|
||||||
const standardSubtasks = standardBundles.map((filename) => {
|
const standardSubtasks = standardBundles.map((filename) => {
|
||||||
return createTask(`${taskPrefix}:${filename}`,
|
return createTask(`${taskPrefix}:${filename}`,
|
||||||
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing })
|
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing }),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
// inpage must be built before contentscript
|
// inpage must be built before contentscript
|
||||||
// because inpage bundle result is included inside contentscript
|
// because inpage bundle result is included inside contentscript
|
||||||
const contentscriptSubtask = createTask(`${taskPrefix}:contentscript`,
|
const contentscriptSubtask = createTask(`${taskPrefix}:contentscript`,
|
||||||
createTaskForBuildJsExtensionContentscript({ devMode, testing })
|
createTaskForBuildJsExtensionContentscript({ devMode, testing }),
|
||||||
)
|
)
|
||||||
|
|
||||||
// task for initiating livereload
|
// task for initiating livereload
|
||||||
@ -156,7 +156,7 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
|
|||||||
externalDependencies: devMode ? undefined : externalDependenciesMap[contentscript],
|
externalDependencies: devMode ? undefined : externalDependenciesMap[contentscript],
|
||||||
devMode,
|
devMode,
|
||||||
testing,
|
testing,
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
"@storybook/storybook-deployer": "^2.8.6",
|
"@storybook/storybook-deployer": "^2.8.6",
|
||||||
"@testing-library/react-hooks": "^3.2.1",
|
"@testing-library/react-hooks": "^3.2.1",
|
||||||
"addons-linter": "1.14.0",
|
"addons-linter": "1.14.0",
|
||||||
"babel-eslint": "^10.0.2",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
"brfs": "^1.6.1",
|
"brfs": "^1.6.1",
|
||||||
@ -207,7 +207,7 @@
|
|||||||
"envify": "^4.1.0",
|
"envify": "^4.1.0",
|
||||||
"enzyme": "^3.10.0",
|
"enzyme": "^3.10.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.1",
|
"enzyme-adapter-react-16": "^1.15.1",
|
||||||
"eslint": "^6.0.1",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-babel": "^5.3.0",
|
"eslint-plugin-babel": "^5.3.0",
|
||||||
"eslint-plugin-import": "^2.19.1",
|
"eslint-plugin-import": "^2.19.1",
|
||||||
"eslint-plugin-json": "^1.2.0",
|
"eslint-plugin-json": "^1.2.0",
|
||||||
|
@ -23,7 +23,7 @@ describe('Localization', function () {
|
|||||||
const [fiatAmount, fiatUnit] = secondaryBalanceText.trim().split(/\s+/)
|
const [fiatAmount, fiatUnit] = secondaryBalanceText.trim().split(/\s+/)
|
||||||
assert.ok(fiatAmount.startsWith('₱'))
|
assert.ok(fiatAmount.startsWith('₱'))
|
||||||
assert.equal(fiatUnit, 'PHP')
|
assert.equal(fiatUnit, 'PHP')
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -34,7 +34,7 @@ describe('Personal sign', function () {
|
|||||||
await driver.clickElement(By.css('[data-testid="request-signature__sign"]'))
|
await driver.clickElement(By.css('[data-testid="request-signature__sign"]'))
|
||||||
|
|
||||||
await driver.waitUntilXWindowHandles(2)
|
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="page-container-footer-next"]'))
|
||||||
await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))
|
await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))
|
||||||
await driver.findElement(By.css('.transaction-list-item'))
|
await driver.findElement(By.css('.transaction-list-item'))
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@ class Driver {
|
|||||||
this.driver.wait(until.elementIsEnabled(element), this.timeout),
|
this.driver.wait(until.elementIsEnabled(element), this.timeout),
|
||||||
)
|
)
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, []),
|
||||||
)
|
)
|
||||||
return elements
|
return elements
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ describe('DetectTokensController', function () {
|
|||||||
[
|
[
|
||||||
{ address: existingTokenAddress.toLowerCase(), decimals: existingToken.decimals, symbol: existingToken.symbol },
|
{ address: existingTokenAddress.toLowerCase(), decimals: existingToken.decimals, symbol: existingToken.symbol },
|
||||||
{ address: tokenAddressToAdd.toLowerCase(), decimals: tokenToAdd.decimals, symbol: tokenToAdd.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 >= startTime &&
|
||||||
firstVaultIdentities[TEST_ADDRESS].lastSelected <= endTime
|
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
|
delete firstVaultIdentities[TEST_ADDRESS].lastSelected
|
||||||
assert.deepEqual(firstVaultIdentities, {
|
assert.deepEqual(firstVaultIdentities, {
|
||||||
@ -269,7 +269,7 @@ describe('MetaMaskController', function () {
|
|||||||
secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected >= startTime &&
|
secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected >= startTime &&
|
||||||
secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected <= endTime
|
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
|
delete secondVaultIdentities[TEST_ADDRESS_ALT].lastSelected
|
||||||
assert.deepEqual(secondVaultIdentities, {
|
assert.deepEqual(secondVaultIdentities, {
|
||||||
@ -404,7 +404,7 @@ describe('MetaMaskController', function () {
|
|||||||
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
|
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
|
||||||
await metamaskController.connectHardware('trezor', 0).catch(() => null)
|
await metamaskController.connectHardware('trezor', 0).catch(() => null)
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
||||||
'Trezor Hardware'
|
'Trezor Hardware',
|
||||||
)
|
)
|
||||||
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Trezor Hardware')
|
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Trezor Hardware')
|
||||||
assert.equal(keyrings.length, 1)
|
assert.equal(keyrings.length, 1)
|
||||||
@ -414,7 +414,7 @@ describe('MetaMaskController', function () {
|
|||||||
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
|
sinon.spy(metamaskController.keyringController, 'addNewKeyring')
|
||||||
await metamaskController.connectHardware('ledger', 0).catch(() => null)
|
await metamaskController.connectHardware('ledger', 0).catch(() => null)
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
||||||
'Ledger Hardware'
|
'Ledger Hardware',
|
||||||
)
|
)
|
||||||
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Ledger Hardware')
|
assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Ledger Hardware')
|
||||||
assert.equal(keyrings.length, 1)
|
assert.equal(keyrings.length, 1)
|
||||||
@ -451,7 +451,7 @@ describe('MetaMaskController', function () {
|
|||||||
await metamaskController.connectHardware('trezor', 0).catch(() => null)
|
await metamaskController.connectHardware('trezor', 0).catch(() => null)
|
||||||
await metamaskController.forgetDevice('trezor')
|
await metamaskController.forgetDevice('trezor')
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
||||||
'Trezor Hardware'
|
'Trezor Hardware',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.deepEqual(keyrings[0].accounts, [])
|
assert.deepEqual(keyrings[0].accounts, [])
|
||||||
@ -498,7 +498,7 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
it('should set unlockedAccount in the keyring', async function () {
|
it('should set unlockedAccount in the keyring', async function () {
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
||||||
'Trezor Hardware'
|
'Trezor Hardware',
|
||||||
)
|
)
|
||||||
assert.equal(keyrings[0].unlockedAccount, accountToUnlock)
|
assert.equal(keyrings[0].unlockedAccount, accountToUnlock)
|
||||||
})
|
})
|
||||||
|
@ -14,7 +14,7 @@ import { noop } from './mocks'
|
|||||||
*/
|
*/
|
||||||
export function grantPermissions (permController, origin, permissions) {
|
export function grantPermissions (permController, origin, permissions) {
|
||||||
permController.permissions.grantNewPermissions(
|
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.
|
* @param {boolean} success - Whether the request succeeded or not.
|
||||||
*/
|
*/
|
||||||
export function validateActivityEntry (
|
export function validateActivityEntry (
|
||||||
entry, req, res, methodType, success
|
entry, req, res, methodType, success,
|
||||||
) {
|
) {
|
||||||
assert.doesNotThrow(
|
assert.doesNotThrow(
|
||||||
() => {
|
() => {
|
||||||
_validateActivityEntry(
|
_validateActivityEntry(
|
||||||
entry, req, res, methodType, success
|
entry, req, res, methodType, success,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
'should have expected activity entry'
|
'should have expected activity entry',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function _validateActivityEntry (
|
function _validateActivityEntry (
|
||||||
entry, req, res, methodType, success
|
entry, req, res, methodType, success,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
assert.ok(entry, 'entry should exist')
|
assert.ok(entry, 'entry should exist')
|
||||||
@ -77,7 +77,7 @@ function _validateActivityEntry (
|
|||||||
assert.equal(entry.methodType, methodType)
|
assert.equal(entry.methodType, methodType)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
entry.request, req,
|
entry.request, req,
|
||||||
'entry.request should equal the request'
|
'entry.request should equal the request',
|
||||||
)
|
)
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -87,23 +87,23 @@ function _validateActivityEntry (
|
|||||||
Number.isInteger(entry.requestTime) &&
|
Number.isInteger(entry.requestTime) &&
|
||||||
Number.isInteger(entry.responseTime)
|
Number.isInteger(entry.responseTime)
|
||||||
),
|
),
|
||||||
'request and response times should be numbers'
|
'request and response times should be numbers',
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
(entry.requestTime <= entry.responseTime),
|
(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.equal(entry.success, success)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
entry.response, res,
|
entry.response, res,
|
||||||
'entry.response should equal the response'
|
'entry.response should equal the response',
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
Number.isInteger(entry.requestTime) && entry.requestTime > 0,
|
Number.isInteger(entry.requestTime) && entry.requestTime > 0,
|
||||||
'entry should have non-zero request time'
|
'entry should have non-zero request time',
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
(
|
(
|
||||||
@ -111,7 +111,7 @@ function _validateActivityEntry (
|
|||||||
entry.responseTime === null &&
|
entry.responseTime === null &&
|
||||||
entry.response === 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}` }
|
identities[address] = { address, name: `Account ${index}` }
|
||||||
return identities
|
return identities
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -100,7 +100,7 @@ describe('permissions log', function () {
|
|||||||
assert.equal(log.length, 1, 'log should have single entry')
|
assert.equal(log.length, 1, 'log should have single entry')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry1, { ...req }, { ...res },
|
entry1, { ...req }, { ...res },
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// eth_accounts, failure
|
// eth_accounts, failure
|
||||||
@ -117,7 +117,7 @@ describe('permissions log', function () {
|
|||||||
assert.equal(log.length, 2, 'log should have 2 entries')
|
assert.equal(log.length, 2, 'log should have 2 entries')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry2, { ...req }, { ...res },
|
entry2, { ...req }, { ...res },
|
||||||
LOG_METHOD_TYPES.restricted, false
|
LOG_METHOD_TYPES.restricted, false,
|
||||||
)
|
)
|
||||||
|
|
||||||
// eth_requestAccounts, success
|
// eth_requestAccounts, success
|
||||||
@ -134,7 +134,7 @@ describe('permissions log', function () {
|
|||||||
assert.equal(log.length, 3, 'log should have 3 entries')
|
assert.equal(log.length, 3, 'log should have 3 entries')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry3, { ...req }, { ...res },
|
entry3, { ...req }, { ...res },
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// test_method, no response
|
// test_method, no response
|
||||||
@ -151,7 +151,7 @@ describe('permissions log', function () {
|
|||||||
assert.equal(log.length, 4, 'log should have 4 entries')
|
assert.equal(log.length, 4, 'log should have 4 entries')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry4, { ...req }, null,
|
entry4, { ...req }, null,
|
||||||
LOG_METHOD_TYPES.restricted, false
|
LOG_METHOD_TYPES.restricted, false,
|
||||||
)
|
)
|
||||||
|
|
||||||
// validate final state
|
// validate final state
|
||||||
@ -199,7 +199,7 @@ describe('permissions log', function () {
|
|||||||
entry2.id === id2 && entry2.response === null &&
|
entry2.id === id2 && entry2.response === null &&
|
||||||
entry3.id === id3 && entry3.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
|
// call response handlers
|
||||||
@ -216,17 +216,17 @@ describe('permissions log', function () {
|
|||||||
|
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
log[0], { ...req, id: id1 }, { ...res1 },
|
log[0], { ...req, id: id1 }, { ...res1 },
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
log[1], { ...req, id: id2 }, { ...res2 },
|
log[1], { ...req, id: id2 }, { ...res2 },
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
log[2], { ...req, id: id3 }, { ...res3 },
|
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')
|
assert.equal(log.length, 1, 'log should have single entry')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry1, { ...req }, null,
|
entry1, { ...req }, null,
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// next request should be handled as normal
|
// 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')
|
assert.equal(log.length, 2, 'log should have 2 entries')
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
entry2, { ...req }, { ...res },
|
entry2, { ...req }, { ...res },
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// validate final state
|
// validate final state
|
||||||
@ -301,12 +301,12 @@ describe('permissions log', function () {
|
|||||||
// check last entry valid
|
// check last entry valid
|
||||||
let log = permLog.getActivityLog()
|
let log = permLog.getActivityLog()
|
||||||
assert.equal(
|
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(
|
validateActivityEntry(
|
||||||
log[LOG_LIMIT - 1], { ...req, id: lastId }, res,
|
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
|
// store the id of the current second entry
|
||||||
@ -319,18 +319,18 @@ describe('permissions log', function () {
|
|||||||
// check log length
|
// check log length
|
||||||
log = permLog.getActivityLog()
|
log = permLog.getActivityLog()
|
||||||
assert.equal(
|
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
|
// check first and last entries
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
log[0], { ...req, id: nextFirstId }, res,
|
log[0], { ...req, id: nextFirstId }, res,
|
||||||
LOG_METHOD_TYPES.restricted, true
|
LOG_METHOD_TYPES.restricted, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
validateActivityEntry(
|
validateActivityEntry(
|
||||||
log[LOG_LIMIT - 1], { ...req, id: lastId }, res,
|
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
|
let permHistory
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
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() ] }
|
const res = { result: [ PERMS.granted.test_method() ] }
|
||||||
|
|
||||||
@ -370,18 +370,18 @@ describe('permissions log', function () {
|
|||||||
permHistory = permLog.getHistory()
|
permHistory = permLog.getHistory()
|
||||||
assert.equal(
|
assert.equal(
|
||||||
Object.keys(permHistory).length, 1,
|
Object.keys(permHistory).length, 1,
|
||||||
'history should have single origin'
|
'history should have single origin',
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
Boolean(permHistory[DOMAINS.a.origin]),
|
Boolean(permHistory[DOMAINS.a.origin]),
|
||||||
'history should have expected origin'
|
'history should have expected origin',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('ignores malformed permissions requests', function () {
|
it('ignores malformed permissions requests', function () {
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
)
|
)
|
||||||
delete req.params
|
delete req.params
|
||||||
const res = { result: [ PERMS.granted.test_method() ] }
|
const res = { result: [ PERMS.granted.test_method() ] }
|
||||||
@ -397,7 +397,7 @@ describe('permissions log', function () {
|
|||||||
let permHistory
|
let permHistory
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {
|
const res = {
|
||||||
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
||||||
@ -412,7 +412,7 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permHistory,
|
permHistory,
|
||||||
EXPECTED_HISTORIES.case1[0],
|
EXPECTED_HISTORIES.case1[0],
|
||||||
'should have correct history'
|
'should have correct history',
|
||||||
)
|
)
|
||||||
|
|
||||||
// mock permission requested again, with another approved account
|
// mock permission requested again, with another approved account
|
||||||
@ -428,14 +428,14 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permHistory,
|
permHistory,
|
||||||
EXPECTED_HISTORIES.case1[1],
|
EXPECTED_HISTORIES.case1[1],
|
||||||
'should have correct history'
|
'should have correct history',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('handles eth_accounts response without caveats', async function () {
|
it('handles eth_accounts response without caveats', async function () {
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {
|
const res = {
|
||||||
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
||||||
@ -448,14 +448,14 @@ describe('permissions log', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permLog.getHistory(), EXPECTED_HISTORIES.case2[0],
|
permLog.getHistory(), EXPECTED_HISTORIES.case2[0],
|
||||||
'should have expected history'
|
'should have expected history',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('handles extra caveats for eth_accounts', async function () {
|
it('handles extra caveats for eth_accounts', async function () {
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {
|
const res = {
|
||||||
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
result: [ PERMS.granted.eth_accounts(ACCOUNTS.a.permitted) ],
|
||||||
@ -469,7 +469,7 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permLog.getHistory(),
|
permLog.getHistory(),
|
||||||
EXPECTED_HISTORIES.case1[0],
|
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 () {
|
it('handles unrequested permissions on the response', async function () {
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {
|
const res = {
|
||||||
result: [
|
result: [
|
||||||
@ -494,14 +494,14 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permLog.getHistory(),
|
permLog.getHistory(),
|
||||||
EXPECTED_HISTORIES.case1[0],
|
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 () {
|
it('does not update history if no new permissions are approved', async function () {
|
||||||
|
|
||||||
let req = RPC_REQUESTS.requestPermission(
|
let req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
)
|
)
|
||||||
let res = {
|
let res = {
|
||||||
result: [
|
result: [
|
||||||
@ -516,7 +516,7 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permLog.getHistory(),
|
permLog.getHistory(),
|
||||||
EXPECTED_HISTORIES.case4[0],
|
EXPECTED_HISTORIES.case4[0],
|
||||||
'should have correct history'
|
'should have correct history',
|
||||||
)
|
)
|
||||||
|
|
||||||
// new permission requested, but not approved
|
// new permission requested, but not approved
|
||||||
@ -524,7 +524,7 @@ describe('permissions log', function () {
|
|||||||
clock.tick(1)
|
clock.tick(1)
|
||||||
|
|
||||||
req = RPC_REQUESTS.requestPermission(
|
req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
res = {
|
res = {
|
||||||
result: [
|
result: [
|
||||||
@ -539,7 +539,7 @@ describe('permissions log', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permLog.getHistory(),
|
permLog.getHistory(),
|
||||||
EXPECTED_HISTORIES.case4[0],
|
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
|
// first origin
|
||||||
round1.push({
|
round1.push({
|
||||||
req: RPC_REQUESTS.requestPermission(
|
req: RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
),
|
),
|
||||||
res: {
|
res: {
|
||||||
result: [ PERMS.granted.test_method() ],
|
result: [ PERMS.granted.test_method() ],
|
||||||
@ -565,7 +565,7 @@ describe('permissions log', function () {
|
|||||||
// second origin
|
// second origin
|
||||||
round1.push({
|
round1.push({
|
||||||
req: RPC_REQUESTS.requestPermission(
|
req: RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.b.origin, PERM_NAMES.eth_accounts
|
DOMAINS.b.origin, PERM_NAMES.eth_accounts,
|
||||||
),
|
),
|
||||||
res: {
|
res: {
|
||||||
result: [ PERMS.granted.eth_accounts(ACCOUNTS.b.permitted) ],
|
result: [ PERMS.granted.eth_accounts(ACCOUNTS.b.permitted) ],
|
||||||
@ -600,7 +600,7 @@ describe('permissions log', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permHistory, EXPECTED_HISTORIES.case3[0],
|
permHistory, EXPECTED_HISTORIES.case3[0],
|
||||||
'should have expected history'
|
'should have expected history',
|
||||||
)
|
)
|
||||||
|
|
||||||
// make next round of requests
|
// make next round of requests
|
||||||
@ -613,7 +613,7 @@ describe('permissions log', function () {
|
|||||||
// first origin
|
// first origin
|
||||||
round2.push({
|
round2.push({
|
||||||
req: RPC_REQUESTS.requestPermission(
|
req: RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
),
|
),
|
||||||
res: {
|
res: {
|
||||||
result: [ PERMS.granted.test_method() ],
|
result: [ PERMS.granted.test_method() ],
|
||||||
@ -644,7 +644,7 @@ describe('permissions log', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
permHistory, EXPECTED_HISTORIES.case3[1],
|
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 aMiddleware = getPermissionsMiddleware(permController, DOMAINS.a.origin)
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {}
|
const res = {}
|
||||||
|
|
||||||
const pendingApproval = assert.doesNotReject(
|
const pendingApproval = assert.doesNotReject(
|
||||||
aMiddleware(req, res),
|
aMiddleware(req, res),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
@ -88,32 +88,32 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
res.result.length, 1,
|
res.result.length, 1,
|
||||||
'origin should have single approved permission'
|
'origin should have single approved permission',
|
||||||
)
|
)
|
||||||
|
|
||||||
validatePermission(
|
validatePermission(
|
||||||
res.result[0],
|
res.result[0],
|
||||||
PERM_NAMES.eth_accounts,
|
PERM_NAMES.eth_accounts,
|
||||||
DOMAINS.a.origin,
|
DOMAINS.a.origin,
|
||||||
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
|
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
|
||||||
)
|
)
|
||||||
|
|
||||||
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
aAccounts, [ACCOUNTS.a.primary],
|
aAccounts, [ACCOUNTS.a.primary],
|
||||||
'origin should have correct accounts'
|
'origin should have correct accounts',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
permController.notifyAccountsChanged.calledOnceWith(
|
permController.notifyAccountsChanged.calledOnceWith(
|
||||||
DOMAINS.a.origin, aAccounts,
|
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
|
// create first request
|
||||||
|
|
||||||
const req1 = RPC_REQUESTS.requestPermission(
|
const req1 = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res1 = {}
|
const res1 = {}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
const pendingApproval1 = assert.doesNotReject(
|
const pendingApproval1 = assert.doesNotReject(
|
||||||
aMiddleware(req1, res1),
|
aMiddleware(req1, res1),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
const id1 = permController.pendingApprovals.keys().next().value
|
const id1 = permController.pendingApprovals.keys().next().value
|
||||||
@ -144,32 +144,32 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res1.result && !res1.error,
|
res1.result && !res1.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
res1.result.length, 1,
|
res1.result.length, 1,
|
||||||
'origin should have single approved permission'
|
'origin should have single approved permission',
|
||||||
)
|
)
|
||||||
|
|
||||||
validatePermission(
|
validatePermission(
|
||||||
res1.result[0],
|
res1.result[0],
|
||||||
PERM_NAMES.eth_accounts,
|
PERM_NAMES.eth_accounts,
|
||||||
DOMAINS.a.origin,
|
DOMAINS.a.origin,
|
||||||
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
|
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
|
||||||
)
|
)
|
||||||
|
|
||||||
const accounts1 = await permController.getAccounts(DOMAINS.a.origin)
|
const accounts1 = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
accounts1, [ACCOUNTS.a.primary],
|
accounts1, [ACCOUNTS.a.primary],
|
||||||
'origin should have correct accounts'
|
'origin should have correct accounts',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
permController.notifyAccountsChanged.calledOnceWith(
|
permController.notifyAccountsChanged.calledOnceWith(
|
||||||
DOMAINS.a.origin, accounts1,
|
DOMAINS.a.origin, accounts1,
|
||||||
),
|
),
|
||||||
'expected notification call should have been made'
|
'expected notification call should have been made',
|
||||||
)
|
)
|
||||||
|
|
||||||
// create second request
|
// create second request
|
||||||
@ -180,7 +180,7 @@ describe('permissions middleware', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const req2 = RPC_REQUESTS.requestPermissions(
|
const req2 = RPC_REQUESTS.requestPermissions(
|
||||||
DOMAINS.a.origin, { ...requestedPerms2 }
|
DOMAINS.a.origin, { ...requestedPerms2 },
|
||||||
)
|
)
|
||||||
const res2 = {}
|
const res2 = {}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
const pendingApproval2 = assert.doesNotReject(
|
const pendingApproval2 = assert.doesNotReject(
|
||||||
aMiddleware(req2, res2),
|
aMiddleware(req2, res2),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
const id2 = permController.pendingApprovals.keys().next().value
|
const id2 = permController.pendingApprovals.keys().next().value
|
||||||
@ -200,19 +200,19 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res2.result && !res2.error,
|
res2.result && !res2.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
res2.result.length, 2,
|
res2.result.length, 2,
|
||||||
'origin should have single approved permission'
|
'origin should have single approved permission',
|
||||||
)
|
)
|
||||||
|
|
||||||
validatePermission(
|
validatePermission(
|
||||||
res2.result[0],
|
res2.result[0],
|
||||||
PERM_NAMES.eth_accounts,
|
PERM_NAMES.eth_accounts,
|
||||||
DOMAINS.a.origin,
|
DOMAINS.a.origin,
|
||||||
CAVEATS.eth_accounts(ACCOUNTS.b.permitted)
|
CAVEATS.eth_accounts(ACCOUNTS.b.permitted),
|
||||||
)
|
)
|
||||||
|
|
||||||
validatePermission(
|
validatePermission(
|
||||||
@ -224,19 +224,19 @@ describe('permissions middleware', function () {
|
|||||||
const accounts2 = await permController.getAccounts(DOMAINS.a.origin)
|
const accounts2 = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
accounts2, [ACCOUNTS.b.primary],
|
accounts2, [ACCOUNTS.b.primary],
|
||||||
'origin should have correct accounts'
|
'origin should have correct accounts',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
permController.notifyAccountsChanged.callCount, 2,
|
permController.notifyAccountsChanged.callCount, 2,
|
||||||
'should have called notification method 2 times in total'
|
'should have called notification method 2 times in total',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
permController.notifyAccountsChanged.lastCall.calledWith(
|
permController.notifyAccountsChanged.lastCall.calledWith(
|
||||||
DOMAINS.a.origin, accounts2,
|
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 aMiddleware = getPermissionsMiddleware(permController, DOMAINS.a.origin)
|
||||||
|
|
||||||
const req = RPC_REQUESTS.requestPermission(
|
const req = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.eth_accounts
|
DOMAINS.a.origin, PERM_NAMES.eth_accounts,
|
||||||
)
|
)
|
||||||
const res = {}
|
const res = {}
|
||||||
|
|
||||||
@ -272,17 +272,17 @@ describe('permissions middleware', function () {
|
|||||||
!res.result && res.error &&
|
!res.result && res.error &&
|
||||||
res.error.message === expectedError.message
|
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)
|
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
aAccounts, [], 'origin should have have correct accounts'
|
aAccounts, [], 'origin should have have correct accounts',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
permController.notifyAccountsChanged.notCalled,
|
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, {
|
DOMAINS.a.origin, {
|
||||||
...PERMS.requests.does_not_exist(),
|
...PERMS.requests.does_not_exist(),
|
||||||
...PERMS.requests.test_method(),
|
...PERMS.requests.test_method(),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
const res = {}
|
const res = {}
|
||||||
|
|
||||||
const expectedError = ERRORS.rejectPermissionsRequest.methodNotFound(
|
const expectedError = ERRORS.rejectPermissionsRequest.methodNotFound(
|
||||||
PERM_NAMES.does_not_exist
|
PERM_NAMES.does_not_exist,
|
||||||
)
|
)
|
||||||
|
|
||||||
await assert.rejects(
|
await assert.rejects(
|
||||||
@ -318,12 +318,12 @@ describe('permissions middleware', function () {
|
|||||||
!res.result && res.error &&
|
!res.result && res.error &&
|
||||||
res.error.message === expectedError.message
|
res.error.message === expectedError.message
|
||||||
),
|
),
|
||||||
'response should have expected error and no result'
|
'response should have expected error and no result',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
permController.notifyAccountsChanged.notCalled,
|
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
|
// create and start processing first request for first origin
|
||||||
|
|
||||||
const reqA1 = RPC_REQUESTS.requestPermission(
|
const reqA1 = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
)
|
)
|
||||||
const resA1 = {}
|
const resA1 = {}
|
||||||
|
|
||||||
const requestApproval1 = assert.doesNotReject(
|
const requestApproval1 = assert.doesNotReject(
|
||||||
aMiddleware(reqA1, resA1),
|
aMiddleware(reqA1, resA1),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
// create and start processing first request for second origin
|
// create and start processing first request for second origin
|
||||||
|
|
||||||
const reqB1 = RPC_REQUESTS.requestPermission(
|
const reqB1 = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.b.origin, PERM_NAMES.test_method
|
DOMAINS.b.origin, PERM_NAMES.test_method,
|
||||||
)
|
)
|
||||||
const resB1 = {}
|
const resB1 = {}
|
||||||
|
|
||||||
const requestApproval2 = assert.doesNotReject(
|
const requestApproval2 = assert.doesNotReject(
|
||||||
bMiddleware(reqB1, resB1),
|
bMiddleware(reqB1, resB1),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
@ -369,7 +369,7 @@ describe('permissions middleware', function () {
|
|||||||
// which should throw
|
// which should throw
|
||||||
|
|
||||||
const reqA2 = RPC_REQUESTS.requestPermission(
|
const reqA2 = RPC_REQUESTS.requestPermission(
|
||||||
DOMAINS.a.origin, PERM_NAMES.test_method
|
DOMAINS.a.origin, PERM_NAMES.test_method,
|
||||||
)
|
)
|
||||||
const resA2 = {}
|
const resA2 = {}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ describe('permissions middleware', function () {
|
|||||||
!resA2.result && resA2.error &&
|
!resA2.result && resA2.error &&
|
||||||
resA2.error.message === expectedError.message
|
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
|
// first requests for both origins should remain
|
||||||
@ -398,7 +398,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
for (const id of permController.pendingApprovals.keys()) {
|
for (const id of permController.pendingApprovals.keys()) {
|
||||||
await permController.approvePermissionsRequest(
|
await permController.approvePermissionsRequest(
|
||||||
PERMS.approvedRequest(id, PERMS.requests.test_method())
|
PERMS.approvedRequest(id, PERMS.requests.test_method()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
await requestApproval1
|
await requestApproval1
|
||||||
@ -406,20 +406,20 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
resA1.result && !resA1.error,
|
resA1.result && !resA1.error,
|
||||||
'first response should have result and no error'
|
'first response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
resA1.result.length, 1,
|
resA1.result.length, 1,
|
||||||
'first origin should have single approved permission'
|
'first origin should have single approved permission',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
resB1.result && !resB1.error,
|
resB1.result && !resB1.error,
|
||||||
'second response should have result and no error'
|
'second response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
resB1.result.length, 1,
|
resB1.result.length, 1,
|
||||||
'second origin should have single approved permission'
|
'second origin should have single approved permission',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
@ -457,7 +457,7 @@ describe('permissions middleware', function () {
|
|||||||
!res.result && res.error &&
|
!res.result && res.error &&
|
||||||
res.error.code === expectedError.code
|
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(
|
await assert.doesNotReject(
|
||||||
bMiddleware(req, res),
|
bMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && res.result === 1,
|
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(
|
await assert.doesNotReject(
|
||||||
aMiddleware(req, res),
|
aMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res.result, [],
|
res.result, [],
|
||||||
'response should have correct result'
|
'response should have correct result',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
grantPermissions(
|
grantPermissions(
|
||||||
permController, DOMAINS.a.origin,
|
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)
|
const req = RPC_REQUESTS.eth_accounts(DOMAINS.a.origin)
|
||||||
@ -526,16 +526,16 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
await assert.doesNotReject(
|
await assert.doesNotReject(
|
||||||
aMiddleware(req, res),
|
aMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res.result, [ACCOUNTS.a.primary],
|
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(
|
const pendingApproval = assert.doesNotReject(
|
||||||
aMiddleware(req, res),
|
aMiddleware(req, res),
|
||||||
'should not reject permissions request'
|
'should not reject permissions request',
|
||||||
)
|
)
|
||||||
|
|
||||||
await userApprovalPromise
|
await userApprovalPromise
|
||||||
@ -581,31 +581,31 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
perms.length, 1,
|
perms.length, 1,
|
||||||
'domain should have correct number of permissions'
|
'domain should have correct number of permissions',
|
||||||
)
|
)
|
||||||
|
|
||||||
validatePermission(
|
validatePermission(
|
||||||
perms[0],
|
perms[0],
|
||||||
PERM_NAMES.eth_accounts,
|
PERM_NAMES.eth_accounts,
|
||||||
DOMAINS.a.origin,
|
DOMAINS.a.origin,
|
||||||
CAVEATS.eth_accounts(ACCOUNTS.a.permitted)
|
CAVEATS.eth_accounts(ACCOUNTS.a.permitted),
|
||||||
)
|
)
|
||||||
|
|
||||||
// we should also see the accounts on the response
|
// we should also see the accounts on the response
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res.result, [ACCOUNTS.a.primary],
|
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
|
// we should also be able to get the accounts independently
|
||||||
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
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.result && res.error &&
|
||||||
res.error.message === expectedError.message
|
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)
|
const aAccounts = await permController.getAccounts(DOMAINS.a.origin)
|
||||||
assert.deepEqual(
|
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(
|
grantPermissions(
|
||||||
permController, DOMAINS.c.origin,
|
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)
|
const req = RPC_REQUESTS.eth_requestAccounts(DOMAINS.c.origin)
|
||||||
@ -666,16 +666,16 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
await assert.doesNotReject(
|
await assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res.result, [ACCOUNTS.c.primary],
|
res.result, [ACCOUNTS.c.primary],
|
||||||
'response should have correct result'
|
'response should have correct result',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
grantPermissions(
|
grantPermissions(
|
||||||
permController, DOMAINS.c.origin,
|
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)
|
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
|
// this will block until we resolve the unlock Promise
|
||||||
const requestApproval = assert.doesNotReject(
|
const requestApproval = assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
// this will reject because of the already pending request
|
// this will reject because of the already pending request
|
||||||
await assert.rejects(
|
await assert.rejects(
|
||||||
cMiddleware({ ...req }, {}),
|
cMiddleware({ ...req }, {}),
|
||||||
ERRORS.eth_requestAccounts.requestAlreadyPending()
|
ERRORS.eth_requestAccounts.requestAlreadyPending(),
|
||||||
)
|
)
|
||||||
|
|
||||||
// now unlock and let through the first request
|
// now unlock and let through the first request
|
||||||
@ -717,11 +717,11 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
res.result && !res.error,
|
res.result && !res.error,
|
||||||
'response should have result and no error'
|
'response should have result and no error',
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res.result, [ACCOUNTS.c.primary],
|
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(
|
await assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(res.result, 'result should be true')
|
assert.ok(res.result, 'result should be true')
|
||||||
@ -766,7 +766,7 @@ describe('permissions middleware', function () {
|
|||||||
lastUpdated: 1,
|
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(
|
await assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(res.result, 'result should be true')
|
assert.ok(res.result, 'result should be true')
|
||||||
@ -793,7 +793,7 @@ describe('permissions middleware', function () {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
metadataStore,
|
metadataStore,
|
||||||
{ [DOMAINS.c.origin]: { name, extensionId, lastUpdated: 1 } },
|
{ [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(
|
await assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(res.result, 'result should be true')
|
assert.ok(res.result, 'result should be true')
|
||||||
@ -817,7 +817,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
metadataStore, {},
|
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(
|
await assert.doesNotReject(
|
||||||
cMiddleware(req, res),
|
cMiddleware(req, res),
|
||||||
'should not reject'
|
'should not reject',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(res.result, 'result should be true')
|
assert.ok(res.result, 'result should be true')
|
||||||
@ -840,7 +840,7 @@ describe('permissions middleware', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
metadataStore, {},
|
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(
|
await assert.rejects(
|
||||||
ethAccountsMethod(null, res, null),
|
ethAccountsMethod(null, res, null),
|
||||||
fooError,
|
fooError,
|
||||||
'Should reject with expected error'
|
'Should reject with expected error',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
res, { error: fooError },
|
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] = {}
|
identities[address] = {}
|
||||||
return identities
|
return identities
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
getKeyringAccounts: async () => [...keyringAccounts],
|
getKeyringAccounts: async () => [...keyringAccounts],
|
||||||
@ -88,7 +88,7 @@ describe('restricted methods', function () {
|
|||||||
identities[address] = { lastSelected: 1000 }
|
identities[address] = { lastSelected: 1000 }
|
||||||
return identities
|
return identities
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
getKeyringAccounts: async () => [...keyringAccounts],
|
getKeyringAccounts: async () => [...keyringAccounts],
|
||||||
@ -110,7 +110,7 @@ describe('restricted methods', function () {
|
|||||||
identities[address] = { lastSelected: index * 1000 }
|
identities[address] = { lastSelected: index * 1000 }
|
||||||
return identities
|
return identities
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
getKeyringAccounts: async () => [...keyringAccounts],
|
getKeyringAccounts: async () => [...keyringAccounts],
|
||||||
|
@ -67,7 +67,7 @@ describe('Account Menu', function () {
|
|||||||
wrapper = mountWithRouter(
|
wrapper = mountWithRouter(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<AccountMenu.WrappedComponent {...props} />
|
<AccountMenu.WrappedComponent {...props} />
|
||||||
</Provider>, store
|
</Provider>, store,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -36,5 +36,5 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withRouter,
|
withRouter,
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
connect(mapStateToProps, mapDispatchToProps),
|
||||||
)(AppHeader)
|
)(AppHeader)
|
||||||
|
@ -32,7 +32,7 @@ describe('App Header', function () {
|
|||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
metricsEvent: () => {},
|
metricsEvent: () => {},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ const AssetList = ({ onClickAsset }) => {
|
|||||||
|
|
||||||
const [primaryCurrencyDisplay] = useCurrencyDisplay(
|
const [primaryCurrencyDisplay] = useCurrencyDisplay(
|
||||||
selectedAccountBalance,
|
selectedAccountBalance,
|
||||||
{ numberOfDecimals: primaryNumberOfDecimals, currency: primaryCurrency }
|
{ numberOfDecimals: primaryNumberOfDecimals, currency: primaryCurrency },
|
||||||
)
|
)
|
||||||
|
|
||||||
const [secondaryCurrencyDisplay] = useCurrencyDisplay(
|
const [secondaryCurrencyDisplay] = useCurrencyDisplay(
|
||||||
selectedAccountBalance,
|
selectedAccountBalance,
|
||||||
{ numberOfDecimals: secondaryNumberOfDecimals, currency: secondaryCurrency }
|
{ numberOfDecimals: secondaryNumberOfDecimals, currency: secondaryCurrency },
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -24,7 +24,7 @@ describe('Confirm Detail Row Component', function () {
|
|||||||
onHeaderClick={propsMethodSpies.onHeaderClick}
|
onHeaderClick={propsMethodSpies.onHeaderClick}
|
||||||
headerText="mockHeaderText"
|
headerText="mockHeaderText"
|
||||||
headerTextClassName="mockHeaderClass"
|
headerTextClassName="mockHeaderClass"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ export default class ConnectedAccountsList extends PureComponent {
|
|||||||
shouldRenderListOptions: (props, propName, componentName) => {
|
shouldRenderListOptions: (props, propName, componentName) => {
|
||||||
if (typeof props[propName] !== 'boolean') {
|
if (typeof props[propName] !== 'boolean') {
|
||||||
return new Error(
|
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']) {
|
} else if (props[propName] && !props['removePermittedAccount']) {
|
||||||
return new Error(
|
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(
|
export default compose(
|
||||||
withRouter,
|
withRouter,
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
connect(mapStateToProps, mapDispatchToProps),
|
||||||
)(NetworkDropdown)
|
)(NetworkDropdown)
|
||||||
|
@ -16,7 +16,7 @@ describe('Dropdown', function () {
|
|||||||
style={{ test: 'style' }}
|
style={{ test: 'style' }}
|
||||||
closeMenu={closeMenuSpy}
|
closeMenu={closeMenuSpy}
|
||||||
>
|
>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ describe('Dropdown Menu Components', function () {
|
|||||||
describe('Menu', function () {
|
describe('Menu', function () {
|
||||||
it('adds prop className to menu', function () {
|
it('adds prop className to menu', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<Menu className="Test Class" isShowing />
|
<Menu className="Test Class" isShowing />,
|
||||||
)
|
)
|
||||||
assert.equal(wrapper.find('.menu').prop('className'), 'menu Test Class')
|
assert.equal(wrapper.find('.menu').prop('className'), 'menu Test Class')
|
||||||
})
|
})
|
||||||
@ -25,7 +25,7 @@ describe('Dropdown Menu Components', function () {
|
|||||||
text="test text"
|
text="test text"
|
||||||
className="test foo1"
|
className="test foo1"
|
||||||
onClick={onClickSpy}
|
onClick={onClickSpy}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ describe('Network Dropdown', function () {
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
wrapper = mountWithRouter(
|
wrapper = mountWithRouter(
|
||||||
<NetworkDropdown store={store} />
|
<NetworkDropdown store={store} />,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ function addHexWEIsToRenderableFiat (aHexWEI, bHexWEI, convertedCurrency, conver
|
|||||||
const ethTotal = ethTotalToConvertedCurrency(
|
const ethTotal = ethTotalToConvertedCurrency(
|
||||||
addHexWEIsToDec(aHexWEI, bHexWEI),
|
addHexWEIsToDec(aHexWEI, bHexWEI),
|
||||||
convertedCurrency,
|
convertedCurrency,
|
||||||
conversionRate
|
conversionRate,
|
||||||
)
|
)
|
||||||
return formatCurrency(ethTotal, convertedCurrency)
|
return formatCurrency(ethTotal, convertedCurrency)
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ describe('GasModalPageContainer Component', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
renderBasicTabContentResult.props.gasPriceButtonGroupProps,
|
renderBasicTabContentResult.props.gasPriceButtonGroupProps,
|
||||||
mockGasPriceButtonGroupProps
|
mockGasPriceButtonGroupProps,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -235,7 +235,7 @@ describe('GasModalPageContainer Component', function () {
|
|||||||
'mockNewTotalFiat',
|
'mockNewTotalFiat',
|
||||||
' mockNewTotalEth',
|
' mockNewTotalEth',
|
||||||
' mockSendAmount',
|
' mockSendAmount',
|
||||||
' mockTransactionFee'
|
' mockTransactionFee',
|
||||||
))
|
))
|
||||||
|
|
||||||
assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName))
|
assert(renderedInfoRowsContainer.childAt(0).hasClass(baseClassName))
|
||||||
|
@ -84,7 +84,7 @@ describe('GasPriceButtonGroup Component', function () {
|
|||||||
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[i]),
|
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[i]),
|
||||||
mockButtonPropsAndFlags,
|
mockButtonPropsAndFlags,
|
||||||
i,
|
i,
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ describe('GasPriceButtonGroup Component', function () {
|
|||||||
GasPriceButtonGroup.prototype.renderButtonContent.resetHistory()
|
GasPriceButtonGroup.prototype.renderButtonContent.resetHistory()
|
||||||
const renderButtonResult = GasPriceButtonGroup.prototype.renderButton(
|
const renderButtonResult = GasPriceButtonGroup.prototype.renderButton(
|
||||||
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[0]),
|
Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[0]),
|
||||||
mockButtonPropsAndFlags
|
mockButtonPropsAndFlags,
|
||||||
)
|
)
|
||||||
wrappedRenderButtonResult = shallow(renderButtonResult)
|
wrappedRenderButtonResult = shallow(renderButtonResult)
|
||||||
})
|
})
|
||||||
@ -125,7 +125,7 @@ describe('GasPriceButtonGroup Component', function () {
|
|||||||
assert.equal(mockGasPriceButtonGroupProps.handleGasPriceSelection.callCount, 1)
|
assert.equal(mockGasPriceButtonGroupProps.handleGasPriceSelection.callCount, 1)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockGasPriceButtonGroupProps.handleGasPriceSelection.getCall(0).args,
|
mockGasPriceButtonGroupProps.handleGasPriceSelection.getCall(0).args,
|
||||||
[mockGasPriceButtonGroupProps.gasButtonInfo[0].priceInHexWei]
|
[mockGasPriceButtonGroupProps.gasButtonInfo[0].priceInHexWei],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ describe('GasPriceButtonGroup Component', function () {
|
|||||||
showCheck,
|
showCheck,
|
||||||
className,
|
className,
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -176,7 +176,7 @@ export function setSelectedCircle ({
|
|||||||
|
|
||||||
chart.internal.selectPoint(
|
chart.internal.selectPoint(
|
||||||
generateDataUIObj(currentX.toNumber(), numberOfValues, newTimeEstimate),
|
generateDataUIObj(currentX.toNumber(), numberOfValues, newTimeEstimate),
|
||||||
numberOfValues
|
numberOfValues,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
|
|||||||
|
|
||||||
if (dataToShow.length) {
|
if (dataToShow.length) {
|
||||||
this.tooltip.html(
|
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')
|
).style('display', 'flex')
|
||||||
|
|
||||||
// Get tooltip dimensions
|
// Get tooltip dimensions
|
||||||
|
@ -35,7 +35,7 @@ describe('MenuBar', function () {
|
|||||||
const wrapper = mountWithRouter(
|
const wrapper = mountWithRouter(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<MenuBar />
|
<MenuBar />
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
assert.ok(!wrapper.exists('AccountOptionsMenu'))
|
assert.ok(!wrapper.exists('AccountOptionsMenu'))
|
||||||
const accountOptions = wrapper.find('.menu-bar__account-options')
|
const accountOptions = wrapper.find('.menu-bar__account-options')
|
||||||
@ -49,7 +49,7 @@ describe('MenuBar', function () {
|
|||||||
const wrapper = mountWithRouter(
|
const wrapper = mountWithRouter(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<MenuBar />
|
<MenuBar />
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
const accountOptions = wrapper.find('.menu-bar__account-options')
|
const accountOptions = wrapper.find('.menu-bar__account-options')
|
||||||
accountOptions.simulate('click')
|
accountOptions.simulate('click')
|
||||||
|
@ -8,7 +8,7 @@ describe('ModalContent Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title="Modal Title"
|
title="Modal Title"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('.modal-content__title').length, 1)
|
assert.equal(wrapper.find('.modal-content__title').length, 1)
|
||||||
@ -20,7 +20,7 @@ describe('ModalContent Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<ModalContent
|
<ModalContent
|
||||||
description="Modal Description"
|
description="Modal Description"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('.modal-content__title').length, 0)
|
assert.equal(wrapper.find('.modal-content__title').length, 0)
|
||||||
@ -33,7 +33,7 @@ describe('ModalContent Component', function () {
|
|||||||
<ModalContent
|
<ModalContent
|
||||||
title="Modal Title"
|
title="Modal Title"
|
||||||
description="Modal Description"
|
description="Modal Description"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('.modal-content__title').length, 1)
|
assert.equal(wrapper.find('.modal-content__title').length, 1)
|
||||||
|
@ -24,7 +24,7 @@ describe('Modal Component', function () {
|
|||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
submitText="Submit"
|
submitText="Submit"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const buttons = wrapper.find(Button)
|
const buttons = wrapper.find(Button)
|
||||||
@ -54,7 +54,7 @@ describe('Modal Component', function () {
|
|||||||
onSubmit={() => {}}
|
onSubmit={() => {}}
|
||||||
submitText="Submit"
|
submitText="Submit"
|
||||||
submitType="confirm"
|
submitType="confirm"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const buttons = wrapper.find(Button)
|
const buttons = wrapper.find(Button)
|
||||||
@ -72,7 +72,7 @@ describe('Modal Component', function () {
|
|||||||
submitText="Submit"
|
submitText="Submit"
|
||||||
>
|
>
|
||||||
<div className="test-child" />
|
<div className="test-child" />
|
||||||
</Modal>
|
</Modal>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.find('.test-class'))
|
assert.ok(wrapper.find('.test-class'))
|
||||||
@ -89,7 +89,7 @@ describe('Modal Component', function () {
|
|||||||
submitText="Submit"
|
submitText="Submit"
|
||||||
headerText="My Header"
|
headerText="My Header"
|
||||||
onClose={handleCancel}
|
onClose={handleCancel}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.find('.modal-container__header'))
|
assert.ok(wrapper.find('.modal-container__header'))
|
||||||
@ -113,7 +113,7 @@ describe('Modal Component', function () {
|
|||||||
submitDisabled
|
submitDisabled
|
||||||
headerText="My Header"
|
headerText="My Header"
|
||||||
onClose={handleCancel}
|
onClose={handleCancel}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const buttons = wrapper.find(Button)
|
const buttons = wrapper.find(Button)
|
||||||
|
@ -9,7 +9,7 @@ describe('CancelTransactionGasFee Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<CancelTransactionGasFee
|
<CancelTransactionGasFee
|
||||||
value="0x3b9aca00"
|
value="0x3b9aca00"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -19,7 +19,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
toNumericBase: 'hex',
|
toNumericBase: 'hex',
|
||||||
multiplicandBase: 16,
|
multiplicandBase: 16,
|
||||||
multiplierBase: 10,
|
multiplierBase: 10,
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const newGasFee = getHexGasTotal({ gasPrice: defaultNewGasPrice, gasLimit: '0x5208' })
|
const newGasFee = getHexGasTotal({ gasPrice: defaultNewGasPrice, gasLimit: '0x5208' })
|
||||||
|
@ -14,7 +14,7 @@ describe('CancelTransaction Component', function () {
|
|||||||
<CancelTransaction
|
<CancelTransaction
|
||||||
newGasFee="0x1319718a5000"
|
newGasFee="0x1319718a5000"
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -36,7 +36,7 @@ describe('CancelTransaction Component', function () {
|
|||||||
hideModal={hideModalSpy}
|
hideModal={hideModalSpy}
|
||||||
showTransactionConfirmedModal={() => {}}
|
showTransactionConfirmedModal={() => {}}
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find(Modal).length, 1)
|
assert.equal(wrapper.find(Modal).length, 1)
|
||||||
|
@ -12,5 +12,5 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withModalProps,
|
withModalProps,
|
||||||
connect(null, mapDispatchToProps)
|
connect(null, mapDispatchToProps),
|
||||||
)(ConfirmDeleteNetwork)
|
)(ConfirmDeleteNetwork)
|
||||||
|
@ -20,7 +20,7 @@ describe('Confirm Delete Network', function () {
|
|||||||
context: {
|
context: {
|
||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,5 +18,5 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withModalProps,
|
withModalProps,
|
||||||
connect(mapStateToProps, mapDispatchToProps)
|
connect(mapStateToProps, mapDispatchToProps),
|
||||||
)(ConfirmRemoveAccount)
|
)(ConfirmRemoveAccount)
|
||||||
|
@ -44,7 +44,7 @@ describe('Confirm Remove Account', function () {
|
|||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
store: PropTypes.object,
|
store: PropTypes.object,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,5 +12,5 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withModalProps,
|
withModalProps,
|
||||||
connect(null, mapDispatchToProps)
|
connect(null, mapDispatchToProps),
|
||||||
)(ConfirmResetAccount)
|
)(ConfirmResetAccount)
|
||||||
|
@ -18,7 +18,7 @@ describe('Confirm Reset Account', function () {
|
|||||||
context: {
|
context: {
|
||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ export default class EditApprovalPermission extends PureComponent {
|
|||||||
const error = this.validateSpendLimit()
|
const error = this.validateSpendLimit()
|
||||||
const disabled = Boolean(
|
const disabled = Boolean(
|
||||||
(customSpendLimit === customTokenAmount && !selectedOptionIsUnlimited) ||
|
(customSpendLimit === customTokenAmount && !selectedOptionIsUnlimited) ||
|
||||||
error
|
error,
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -14,5 +14,5 @@ const mapStateToProps = (state) => {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withModalProps,
|
withModalProps,
|
||||||
connect(mapStateToProps)
|
connect(mapStateToProps),
|
||||||
)(EditApprovalPermission)
|
)(EditApprovalPermission)
|
||||||
|
@ -19,7 +19,7 @@ describe('MetaMetrics Opt In', function () {
|
|||||||
context: {
|
context: {
|
||||||
metricsEvent: () => {},
|
metricsEvent: () => {},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe('Reject Transactions Model', function () {
|
|||||||
context: {
|
context: {
|
||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ describe('Account Details Modal', function () {
|
|||||||
context: {
|
context: {
|
||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ describe('Transaction Confirmed', function () {
|
|||||||
context: {
|
context: {
|
||||||
t: (str) => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
const submit = wrapper.find('.btn-secondary.modal-container__footer-button')
|
const submit = wrapper.find('.btn-secondary.modal-container__footer-button')
|
||||||
submit.simulate('click')
|
submit.simulate('click')
|
||||||
|
@ -115,21 +115,21 @@ export default class PermissionPageContainerContent extends PureComponent {
|
|||||||
} else if (allIdentitiesSelected) {
|
} else if (allIdentitiesSelected) {
|
||||||
return t(
|
return t(
|
||||||
'connectToAll',
|
'connectToAll',
|
||||||
[ this.renderAccountTooltip(t('connectToAllAccounts')) ]
|
[ this.renderAccountTooltip(t('connectToAllAccounts')) ],
|
||||||
)
|
)
|
||||||
} else if (selectedIdentities.length > 1) {
|
} else if (selectedIdentities.length > 1) {
|
||||||
return t(
|
return t(
|
||||||
'connectToMultiple',
|
'connectToMultiple',
|
||||||
[
|
[
|
||||||
this.renderAccountTooltip(t('connectToMultipleNumberOfAccounts', [ selectedIdentities.length ])),
|
this.renderAccountTooltip(t('connectToMultipleNumberOfAccounts', [ selectedIdentities.length ])),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return t(
|
return t(
|
||||||
'connectTo',
|
'connectTo',
|
||||||
[
|
[
|
||||||
this.getAccountDescriptor(selectedIdentities[0]),
|
this.getAccountDescriptor(selectedIdentities[0]),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export default class PermissionPageContainer extends Component {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
selectedPermissions: this.getRequestedMethodState(
|
selectedPermissions: this.getRequestedMethodState(
|
||||||
this.getRequestedMethodNames(this.props)
|
this.getRequestedMethodNames(this.props),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ export default class PermissionPageContainer extends Component {
|
|||||||
acc[methodName] = true
|
acc[methodName] = true
|
||||||
return acc
|
return acc
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,5 +75,5 @@ function mergeProps (stateProps, dispatchProps, ownProps) {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withRouter,
|
withRouter,
|
||||||
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
connect(mapStateToProps, mapDispatchToProps, mergeProps),
|
||||||
)(SignatureRequestOriginal)
|
)(SignatureRequestOriginal)
|
||||||
|
@ -56,7 +56,7 @@ describe('Signature Request', function () {
|
|||||||
wrapper = mountWithRouter(
|
wrapper = mountWithRouter(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<SignatureRequest.WrappedComponent {...props} />
|
<SignatureRequest.WrappedComponent {...props} />
|
||||||
</Provider>, store
|
</Provider>, store,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ describe('Token Cell', function () {
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
/>
|
||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ describe('TransactionAction Component', function () {
|
|||||||
transaction={transaction}
|
transaction={transaction}
|
||||||
className="test-class"
|
className="test-class"
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -110,7 +110,7 @@ describe('TransactionAction Component', function () {
|
|||||||
transaction={transaction}
|
transaction={transaction}
|
||||||
className="test-class"
|
className="test-class"
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -44,7 +44,7 @@ describe('TransactionActivityLog Component', function () {
|
|||||||
onRetry={() => {}}
|
onRetry={() => {}}
|
||||||
primaryTransactionStatus="confirmed"
|
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'))
|
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||||
@ -92,7 +92,7 @@ describe('TransactionActivityLog Component', function () {
|
|||||||
primaryTransactionStatus="pending"
|
primaryTransactionStatus="pending"
|
||||||
isEarliestNonce
|
isEarliestNonce
|
||||||
/>,
|
/>,
|
||||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||||
@ -141,7 +141,7 @@ describe('TransactionActivityLog Component', function () {
|
|||||||
primaryTransactionStatus="pending"
|
primaryTransactionStatus="pending"
|
||||||
isEarliestNonce={false}
|
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'))
|
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||||
|
@ -24,7 +24,7 @@ describe('TransactionBreakdown Component', function () {
|
|||||||
transaction={transaction}
|
transaction={transaction}
|
||||||
className="test-class"
|
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'))
|
assert.ok(wrapper.hasClass('transaction-breakdown'))
|
||||||
|
@ -13,7 +13,7 @@ describe('TransactionBreakdownRow Component', function () {
|
|||||||
>
|
>
|
||||||
Test
|
Test
|
||||||
</TransactionBreakdownRow>,
|
</TransactionBreakdownRow>,
|
||||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
||||||
@ -29,7 +29,7 @@ describe('TransactionBreakdownRow Component', function () {
|
|||||||
>
|
>
|
||||||
<Button onClick={() => {}} >Button</Button>
|
<Button onClick={() => {}} >Button</Button>
|
||||||
</TransactionBreakdownRow>,
|
</TransactionBreakdownRow>,
|
||||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
||||||
|
@ -39,7 +39,7 @@ describe('TransactionListItemDetails Component', function () {
|
|||||||
senderNickname="sender-nickname"
|
senderNickname="sender-nickname"
|
||||||
recipientNickname="recipient-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)
|
const child = wrapper.childAt(0)
|
||||||
assert.ok(child.hasClass('transaction-list-item-details'))
|
assert.ok(child.hasClass('transaction-list-item-details'))
|
||||||
@ -83,7 +83,7 @@ describe('TransactionListItemDetails Component', function () {
|
|||||||
senderNickname="sender-nickname"
|
senderNickname="sender-nickname"
|
||||||
recipientNickname="recipient-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)
|
const child = wrapper.childAt(0)
|
||||||
@ -122,7 +122,7 @@ describe('TransactionListItemDetails Component', function () {
|
|||||||
senderNickname="sender-nickname"
|
senderNickname="sender-nickname"
|
||||||
recipientNickname="recipient-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)
|
const child = wrapper.childAt(0)
|
||||||
@ -164,7 +164,7 @@ describe('TransactionListItemDetails Component', function () {
|
|||||||
senderNickname="sender-nickname"
|
senderNickname="sender-nickname"
|
||||||
recipientNickname="recipient-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)
|
const child = wrapper.childAt(0)
|
||||||
|
@ -47,11 +47,11 @@ export default function TransactionList ({ hideTokenTransactions, tokenAddress }
|
|||||||
|
|
||||||
const pendingTransactions = useMemo(
|
const pendingTransactions = useMemo(
|
||||||
() => getFilteredTransactionGroups(unfilteredPendingTransactions, hideTokenTransactions, tokenAddress),
|
() => getFilteredTransactionGroups(unfilteredPendingTransactions, hideTokenTransactions, tokenAddress),
|
||||||
[hideTokenTransactions, tokenAddress, unfilteredPendingTransactions]
|
[hideTokenTransactions, tokenAddress, unfilteredPendingTransactions],
|
||||||
)
|
)
|
||||||
const completedTransactions = useMemo(
|
const completedTransactions = useMemo(
|
||||||
() => getFilteredTransactionGroups(unfilteredCompletedTransactions, hideTokenTransactions, tokenAddress),
|
() => getFilteredTransactionGroups(unfilteredCompletedTransactions, hideTokenTransactions, tokenAddress),
|
||||||
[hideTokenTransactions, tokenAddress, unfilteredCompletedTransactions]
|
[hideTokenTransactions, tokenAddress, unfilteredCompletedTransactions],
|
||||||
)
|
)
|
||||||
|
|
||||||
const { fetchGasEstimates, fetchBasicGasAndTimeEstimates } = useMemo(() => ({
|
const { fetchGasEstimates, fetchBasicGasAndTimeEstimates } = useMemo(() => ({
|
||||||
|
@ -16,7 +16,7 @@ describe('TransactionStatus Component', function () {
|
|||||||
<TransactionStatus
|
<TransactionStatus
|
||||||
status="confirmed"
|
status="confirmed"
|
||||||
date="June 1"
|
date="June 1"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -29,7 +29,7 @@ describe('TransactionStatus Component', function () {
|
|||||||
status="approved"
|
status="approved"
|
||||||
isEarliestNonce
|
isEarliestNonce
|
||||||
error={{ message: 'test-title' }}
|
error={{ message: 'test-title' }}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -43,7 +43,7 @@ describe('TransactionStatus Component', function () {
|
|||||||
date="June 1"
|
date="June 1"
|
||||||
status="submitted"
|
status="submitted"
|
||||||
isEarliestNonce
|
isEarliestNonce
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -54,7 +54,7 @@ describe('TransactionStatus Component', function () {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<TransactionStatus
|
<TransactionStatus
|
||||||
status="queued"
|
status="queued"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -66,7 +66,7 @@ describe('TransactionStatus Component', function () {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<TransactionStatus
|
<TransactionStatus
|
||||||
status="unapproved"
|
status="unapproved"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -16,7 +16,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
|
|||||||
})
|
})
|
||||||
it('should render properly', function () {
|
it('should render properly', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UserPreferencedCurrencyDisplay />
|
<UserPreferencedCurrencyDisplay />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -29,7 +29,7 @@ describe('UserPreferencedCurrencyDisplay Component', function () {
|
|||||||
prop1
|
prop1
|
||||||
prop2="test"
|
prop2="test"
|
||||||
prop3={1}
|
prop3={1}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -8,7 +8,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
|
|||||||
describe('rendering', function () {
|
describe('rendering', function () {
|
||||||
it('should render properly', function () {
|
it('should render properly', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UserPreferencedCurrencyInput />
|
<UserPreferencedCurrencyInput />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -19,7 +19,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UserPreferencedCurrencyInput
|
<UserPreferencedCurrencyInput
|
||||||
useNativeCurrencyAsPrimaryCurrency
|
useNativeCurrencyAsPrimaryCurrency
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -8,7 +8,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
|
|||||||
describe('rendering', function () {
|
describe('rendering', function () {
|
||||||
it('should render properly', function () {
|
it('should render properly', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UserPreferencedTokenInput token={{ address: '0x0' }} />
|
<UserPreferencedTokenInput token={{ address: '0x0' }} />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -20,7 +20,7 @@ describe('UserPreferencedCurrencyInput Component', function () {
|
|||||||
<UserPreferencedTokenInput
|
<UserPreferencedTokenInput
|
||||||
token={{ address: '0x0' }}
|
token={{ address: '0x0' }}
|
||||||
useNativeCurrencyAsPrimaryCurrency
|
useNativeCurrencyAsPrimaryCurrency
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -14,7 +14,7 @@ describe('AccountMismatchWarning', function () {
|
|||||||
return { address: 'mockedAddress' }
|
return { address: 'mockedAddress' }
|
||||||
}
|
}
|
||||||
throw new Error(
|
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 () {
|
beforeEach(function () {
|
||||||
wrapper = shallow(
|
wrapper = shallow(
|
||||||
<Alert />
|
<Alert />,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ describe('Breadcrumbs Component', function () {
|
|||||||
<Breadcrumbs
|
<Breadcrumbs
|
||||||
currentIndex={1}
|
currentIndex={1}
|
||||||
total={3}
|
total={3}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -33,7 +33,7 @@ const Button = ({ type, submit, large, children, icon, rounded, className, ...bu
|
|||||||
typeHash[type] || CLASSNAME_DEFAULT,
|
typeHash[type] || CLASSNAME_DEFAULT,
|
||||||
large && CLASSNAME_LARGE,
|
large && CLASSNAME_LARGE,
|
||||||
rounded && CLASSNAME_ROUNDED,
|
rounded && CLASSNAME_ROUNDED,
|
||||||
className
|
className,
|
||||||
)}
|
)}
|
||||||
{ ...buttonProps }
|
{ ...buttonProps }
|
||||||
>
|
>
|
||||||
|
@ -11,7 +11,7 @@ describe('Card Component', function () {
|
|||||||
className="card-test-class"
|
className="card-test-class"
|
||||||
>
|
>
|
||||||
<div className="child-test-class">Child</div>
|
<div className="child-test-class">Child</div>
|
||||||
</Card>
|
</Card>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper.hasClass('card-test-class'))
|
assert.ok(wrapper.hasClass('card-test-class'))
|
||||||
|
@ -13,7 +13,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
describe('rendering', function () {
|
describe('rendering', function () {
|
||||||
it('should render properly without a suffix', function () {
|
it('should render properly without a suffix', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<CurrencyInput />
|
<CurrencyInput />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -37,7 +37,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
fiatSuffix="USD"
|
fiatSuffix="USD"
|
||||||
nativeCurrency="ETH"
|
nativeCurrency="ETH"
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -66,7 +66,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
currentCurrency="usd"
|
currentCurrency="usd"
|
||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -100,7 +100,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
currentCurrency="usd"
|
currentCurrency="usd"
|
||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -139,7 +139,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
{
|
{
|
||||||
context: { t: (str) => str + '_t' },
|
context: { t: (str) => str + '_t' },
|
||||||
childContextTypes: { t: PropTypes.func },
|
childContextTypes: { t: PropTypes.func },
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -180,7 +180,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
currentCurrency="usd"
|
currentCurrency="usd"
|
||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -221,7 +221,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
useFiat
|
useFiat
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -262,7 +262,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
useFiat
|
useFiat
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -297,7 +297,7 @@ describe('CurrencyInput Component', function () {
|
|||||||
currentCurrency="usd"
|
currentCurrency="usd"
|
||||||
conversionRate={231.06}
|
conversionRate={231.06}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -46,7 +46,7 @@ Dropdown.propTypes = {
|
|||||||
PropTypes.exact({
|
PropTypes.exact({
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
value: PropTypes.string.isRequired,
|
value: PropTypes.string.isRequired,
|
||||||
})
|
}),
|
||||||
).isRequired,
|
).isRequired,
|
||||||
selectedOption: PropTypes.string,
|
selectedOption: PropTypes.string,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
|
@ -31,7 +31,7 @@ export const simple = () => (
|
|||||||
select(
|
select(
|
||||||
'Selected Option',
|
'Selected Option',
|
||||||
namedOptions.map((option) => option.value),
|
namedOptions.map((option) => option.value),
|
||||||
namedOptions[0].value
|
namedOptions[0].value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -48,7 +48,7 @@ export const optionsWithoutNames = () => (
|
|||||||
select(
|
select(
|
||||||
'Selected Option',
|
'Selected Option',
|
||||||
unnamedOptions.map((option) => option.value),
|
unnamedOptions.map((option) => option.value),
|
||||||
unnamedOptions[0].value
|
unnamedOptions[0].value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -65,7 +65,7 @@ export const optionsWithLongNames = () => (
|
|||||||
select(
|
select(
|
||||||
'Selected Option',
|
'Selected Option',
|
||||||
namedOptionsWithVeryLongNames.map((option) => option.value),
|
namedOptionsWithVeryLongNames.map((option) => option.value),
|
||||||
namedOptionsWithVeryLongNames[0].value
|
namedOptionsWithVeryLongNames[0].value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -82,7 +82,7 @@ export const optionsWithLongNamesAndShortWidth = () => (
|
|||||||
select(
|
select(
|
||||||
'Selected Option',
|
'Selected Option',
|
||||||
namedOptionsWithVeryLongNames.map((option) => option.value),
|
namedOptionsWithVeryLongNames.map((option) => option.value),
|
||||||
namedOptionsWithVeryLongNames[0].value
|
namedOptionsWithVeryLongNames[0].value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
style={{ width: '200px' }}
|
style={{ width: '200px' }}
|
||||||
|
@ -11,7 +11,7 @@ describe('ErrorMessage Component', function () {
|
|||||||
<ErrorMessage
|
<ErrorMessage
|
||||||
errorMessage="This is an error."
|
errorMessage="This is an error."
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -25,7 +25,7 @@ describe('ErrorMessage Component', function () {
|
|||||||
<ErrorMessage
|
<ErrorMessage
|
||||||
errorKey="testKey"
|
errorKey="testKey"
|
||||||
/>,
|
/>,
|
||||||
{ context: { t } }
|
{ context: { t } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -18,7 +18,7 @@ describe('Identicon', function () {
|
|||||||
|
|
||||||
it('renders default eth_logo identicon with no props', function () {
|
it('renders default eth_logo identicon with no props', function () {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<Identicon store={store} />
|
<Identicon store={store} />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('img.identicon__eth-logo').prop('src'), './images/eth_logo.svg')
|
assert.equal(wrapper.find('img.identicon__eth-logo').prop('src'), './images/eth_logo.svg')
|
||||||
@ -30,7 +30,7 @@ describe('Identicon', function () {
|
|||||||
store={store}
|
store={store}
|
||||||
className="test-image"
|
className="test-image"
|
||||||
image="test-image"
|
image="test-image"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('img.test-image').prop('className'), 'identicon test-image')
|
assert.equal(wrapper.find('img.test-image').prop('className'), 'identicon test-image')
|
||||||
@ -43,7 +43,7 @@ describe('Identicon', function () {
|
|||||||
store={store}
|
store={store}
|
||||||
className="test-address"
|
className="test-address"
|
||||||
address="0xTest"
|
address="0xTest"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('div.test-address').prop('className'), 'identicon test-address')
|
assert.equal(wrapper.find('div.test-address').prop('className'), 'identicon test-address')
|
||||||
|
@ -31,7 +31,7 @@ describe('ListItem', function () {
|
|||||||
onClick={clickHandler}
|
onClick={clickHandler}
|
||||||
>
|
>
|
||||||
{CHILDREN}
|
{CHILDREN}
|
||||||
</ListItem>
|
</ListItem>,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('includes the data-testid', function () {
|
it('includes the data-testid', function () {
|
||||||
|
@ -22,7 +22,7 @@ const Menu = ({ anchorElement, children, className, onHide, popperOptions }) =>
|
|||||||
{ children }
|
{ children }
|
||||||
</div>
|
</div>
|
||||||
</>,
|
</>,
|
||||||
popoverContainerElement.current
|
popoverContainerElement.current,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ describe('MetaFoxLogo', function () {
|
|||||||
|
|
||||||
it('sets icon height and width to 42 by default', function () {
|
it('sets icon height and width to 42 by default', function () {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MetaFoxLogo />
|
<MetaFoxLogo />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('img.app-header__metafox-logo--icon').prop('width'), 42)
|
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 () {
|
it('does not set icon height and width when unsetIconHeight is true', function () {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MetaFoxLogo unsetIconHeight />
|
<MetaFoxLogo unsetIconHeight />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('img.app-header__metafox-logo--icon').prop('width'), null)
|
assert.equal(wrapper.find('img.app-header__metafox-logo--icon').prop('width'), null)
|
||||||
|
@ -32,7 +32,7 @@ describe('Page Footer', function () {
|
|||||||
<PageFooter>
|
<PageFooter>
|
||||||
<div>Works</div>
|
<div>Works</div>
|
||||||
</PageFooter>,
|
</PageFooter>,
|
||||||
{ context: { t: sinon.spy((k) => `[${k}]`) } }
|
{ context: { t: sinon.spy((k) => `[${k}]`) } },
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(wrapper.find('.page-container__footer-secondary').length, 1)
|
assert.equal(wrapper.find('.page-container__footer-secondary').length, 1)
|
||||||
|
@ -99,7 +99,7 @@ describe('TokenInput Component', function () {
|
|||||||
}}
|
}}
|
||||||
tokenExchangeRates={{ '0x1': 2 }}
|
tokenExchangeRates={{ '0x1': 2 }}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -133,7 +133,7 @@ describe('TokenInput Component', function () {
|
|||||||
tokenExchangeRates={{ '0x1': 2 }}
|
tokenExchangeRates={{ '0x1': 2 }}
|
||||||
showFiat
|
showFiat
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -216,7 +216,7 @@ describe('TokenInput Component', function () {
|
|||||||
}}
|
}}
|
||||||
tokenExchangeRates={{ '0x1': 2 }}
|
tokenExchangeRates={{ '0x1': 2 }}
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -258,7 +258,7 @@ describe('TokenInput Component', function () {
|
|||||||
tokenExchangeRates={{ '0x1': 2 }}
|
tokenExchangeRates={{ '0x1': 2 }}
|
||||||
showFiat
|
showFiat
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -300,7 +300,7 @@ describe('TokenInput Component', function () {
|
|||||||
tokenExchangeRates={{ '0x1': 2 }}
|
tokenExchangeRates={{ '0x1': 2 }}
|
||||||
showFiat
|
showFiat
|
||||||
/>
|
/>
|
||||||
</Provider>
|
</Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -8,7 +8,7 @@ describe('UnitInput Component', function () {
|
|||||||
describe('rendering', function () {
|
describe('rendering', function () {
|
||||||
it('should render properly without a suffix', function () {
|
it('should render properly without a suffix', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UnitInput />
|
<UnitInput />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -19,7 +19,7 @@ describe('UnitInput Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UnitInput
|
<UnitInput
|
||||||
suffix="ETH"
|
suffix="ETH"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -33,7 +33,7 @@ describe('UnitInput Component', function () {
|
|||||||
<div className="testing">
|
<div className="testing">
|
||||||
TESTCOMPONENT
|
TESTCOMPONENT
|
||||||
</div>
|
</div>
|
||||||
</UnitInput>
|
</UnitInput>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -45,7 +45,7 @@ describe('UnitInput Component', function () {
|
|||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<UnitInput
|
<UnitInput
|
||||||
error
|
error
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -64,7 +64,7 @@ describe('UnitInput Component', function () {
|
|||||||
|
|
||||||
it('should focus the input on component click', function () {
|
it('should focus the input on component click', function () {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<UnitInput />
|
<UnitInput />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -80,7 +80,7 @@ describe('UnitInput Component', function () {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<UnitInput
|
<UnitInput
|
||||||
onChange={handleChangeSpy}
|
onChange={handleChangeSpy}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -96,7 +96,7 @@ describe('UnitInput Component', function () {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<UnitInput
|
<UnitInput
|
||||||
value={123}
|
value={123}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
@ -107,7 +107,7 @@ describe('UnitInput Component', function () {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<UnitInput
|
<UnitInput
|
||||||
onChange={handleChangeSpy}
|
onChange={handleChangeSpy}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
assert.ok(wrapper)
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
|
|
||||||
export const MetaMetricsContext = createContext(() => {
|
export const MetaMetricsContext = createContext(() => {
|
||||||
captureException(
|
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,
|
...mockState.txData,
|
||||||
id: 2,
|
id: 2,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
txData: {},
|
txData: {},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
...mockState.tokenData,
|
...mockState.tokenData,
|
||||||
name: 'defToken',
|
name: 'defToken',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
tokenData: {},
|
tokenData: {},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
...mockState.methodData,
|
...mockState.methodData,
|
||||||
name: 'transferFrom',
|
name: 'transferFrom',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
methodData: {},
|
methodData: {},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
fiatTransactionAmount: '123.45',
|
fiatTransactionAmount: '123.45',
|
||||||
ethTransactionAmount: '.5',
|
ethTransactionAmount: '.5',
|
||||||
hexTransactionAmount: '0x1',
|
hexTransactionAmount: '0x1',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
fiatTransactionFee: '123.45',
|
fiatTransactionFee: '123.45',
|
||||||
ethTransactionFee: '.5',
|
ethTransactionFee: '.5',
|
||||||
hexTransactionFee: '0x1',
|
hexTransactionFee: '0x1',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
fiatTransactionTotal: '123.45',
|
fiatTransactionTotal: '123.45',
|
||||||
ethTransactionTotal: '.5',
|
ethTransactionTotal: '.5',
|
||||||
hexTransactionTotal: '0x1',
|
hexTransactionTotal: '0x1',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
tokenSymbol: 'DEF',
|
tokenSymbol: 'DEF',
|
||||||
tokenDecimals: '1',
|
tokenDecimals: '1',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
nonce: '0x1',
|
nonce: '0x1',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
toSmartContract: true,
|
toSmartContract: true,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
{
|
{
|
||||||
...mockState,
|
...mockState,
|
||||||
fetchingData: true,
|
fetchingData: true,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTxData(txData),
|
actions.updateTxData(txData),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.clearTxData(),
|
actions.clearTxData(),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTokenData(tokenData),
|
actions.updateTokenData(tokenData),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.clearTokenData(),
|
actions.clearTokenData(),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateMethodData(methodData),
|
actions.updateMethodData(methodData),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.clearMethodData(),
|
actions.clearMethodData(),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTransactionAmounts(transactionAmounts),
|
actions.updateTransactionAmounts(transactionAmounts),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTransactionFees(transactionFees),
|
actions.updateTransactionFees(transactionFees),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTransactionTotals(transactionTotals),
|
actions.updateTransactionTotals(transactionTotals),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateTokenProps(tokenProps),
|
actions.updateTokenProps(tokenProps),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.updateNonce(nonce),
|
actions.updateNonce(nonce),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.setFetchingData(true),
|
actions.setFetchingData(true),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.setFetchingData(false),
|
actions.setFetchingData(false),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
actions.clearConfirmTransaction(),
|
actions.clearConfirmTransaction(),
|
||||||
expectedAction
|
expectedAction,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -482,7 +482,7 @@ describe('Confirm Transaction Duck', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
global.eth = {
|
global.eth = {
|
||||||
getCode: sinon.stub().callsFake(
|
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 () {
|
it('should set gasEstimatesLoading to true when receiving a GAS_ESTIMATE_LOADING_STARTED action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
GasReducer(mockState, { type: GAS_ESTIMATE_LOADING_STARTED }),
|
GasReducer(mockState, { type: GAS_ESTIMATE_LOADING_STARTED }),
|
||||||
{ gasEstimatesLoading: true, ...mockState }
|
{ gasEstimatesLoading: true, ...mockState },
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ describe('Gas Duck', function () {
|
|||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
||||||
@ -296,7 +296,7 @@ describe('Gas Duck', function () {
|
|||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(1).args,
|
mockDistpatch.getCall(1).args,
|
||||||
[{ type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
|
[{ type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(2).args,
|
mockDistpatch.getCall(2).args,
|
||||||
@ -310,11 +310,11 @@ describe('Gas Duck', function () {
|
|||||||
fastest: 4,
|
fastest: 4,
|
||||||
safeLow: 1,
|
safeLow: 1,
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(3).args,
|
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(
|
await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{}
|
{},
|
||||||
) }))
|
) }))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(window.fetch.notCalled)
|
assert.ok(window.fetch.notCalled)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -356,11 +356,11 @@ describe('Gas Duck', function () {
|
|||||||
fastest: 45,
|
fastest: 45,
|
||||||
safeLow: 15,
|
safeLow: 15,
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(2).args,
|
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(
|
await fetchBasicGasEstimates()(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{}
|
{},
|
||||||
) }))
|
) }))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
||||||
@ -385,7 +385,7 @@ describe('Gas Duck', function () {
|
|||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(1).args,
|
mockDistpatch.getCall(1).args,
|
||||||
[{ type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
|
[{ type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(2).args,
|
mockDistpatch.getCall(2).args,
|
||||||
@ -399,11 +399,11 @@ describe('Gas Duck', function () {
|
|||||||
fastest: 4,
|
fastest: 4,
|
||||||
safeLow: 1,
|
safeLow: 1,
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(3).args,
|
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(
|
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{ basicPriceAndTimeEstimatesLastRetrieved: 1000000 }
|
{ basicPriceAndTimeEstimatesLastRetrieved: 1000000 },
|
||||||
),
|
),
|
||||||
metamask: { provider: { type: 'ropsten' } },
|
metamask: { provider: { type: 'ropsten' } },
|
||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
||||||
@ -430,7 +430,7 @@ describe('Gas Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(1).args,
|
mockDistpatch.getCall(1).args,
|
||||||
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
|
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -450,11 +450,11 @@ describe('Gas Duck', function () {
|
|||||||
safeLowWait: 'mockSafeLowWait',
|
safeLowWait: 'mockSafeLowWait',
|
||||||
speed: 'mockSpeed',
|
speed: 'mockSpeed',
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(3).args,
|
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(
|
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{}
|
{},
|
||||||
),
|
),
|
||||||
metamask: { provider: { type: 'ropsten' } },
|
metamask: { provider: { type: 'ropsten' } },
|
||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(window.fetch.notCalled)
|
assert.ok(window.fetch.notCalled)
|
||||||
|
|
||||||
@ -509,11 +509,11 @@ describe('Gas Duck', function () {
|
|||||||
safeLowWait: 'mockSafeLowWait',
|
safeLowWait: 'mockSafeLowWait',
|
||||||
speed: 'mockSpeed',
|
speed: 'mockSpeed',
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(2).args,
|
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(
|
await fetchBasicGasAndTimeEstimates()(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{}
|
{},
|
||||||
),
|
),
|
||||||
metamask: { provider: { type: 'ropsten' } },
|
metamask: { provider: { type: 'ropsten' } },
|
||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/ethgasAPI.json'),
|
||||||
@ -541,7 +541,7 @@ describe('Gas Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(1).args,
|
mockDistpatch.getCall(1).args,
|
||||||
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ]
|
[{ type: SET_BASIC_API_ESTIMATES_LAST_RETRIEVED, value: 2000000 } ],
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@ -561,11 +561,11 @@ describe('Gas Duck', function () {
|
|||||||
safeLowWait: 'mockSafeLowWait',
|
safeLowWait: 'mockSafeLowWait',
|
||||||
speed: 'mockSpeed',
|
speed: 'mockSpeed',
|
||||||
},
|
},
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(3).args,
|
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(
|
await fetchGasEstimates(5)(mockDistpatch, () => ({ gas: Object.assign(
|
||||||
{},
|
{},
|
||||||
initState,
|
initState,
|
||||||
{ priceAndTimeEstimatesLastRetrieved: 1000000 }
|
{ priceAndTimeEstimatesLastRetrieved: 1000000 },
|
||||||
),
|
),
|
||||||
metamask: { provider: { type: 'ropsten' } },
|
metamask: { provider: { type: 'ropsten' } },
|
||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/predictTable.json'),
|
window.fetch.getCall(0).args[0].startsWith('https://ethgasstation.info/json/predictTable.json'),
|
||||||
@ -592,7 +592,7 @@ describe('Gas Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(1).args,
|
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]
|
const { type: thirdDispatchCallType, value: priceAndTimeEstimateResult } = mockDistpatch.getCall(2).args[0]
|
||||||
@ -604,7 +604,7 @@ describe('Gas Duck', function () {
|
|||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(3).args,
|
mockDistpatch.getCall(3).args,
|
||||||
[{ type: GAS_ESTIMATE_LOADING_FINISHED }]
|
[{ type: GAS_ESTIMATE_LOADING_FINISHED }],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -621,13 +621,13 @@ describe('Gas Duck', function () {
|
|||||||
expectedWait: 2,
|
expectedWait: 2,
|
||||||
gasprice: 50,
|
gasprice: 50,
|
||||||
}],
|
}],
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
metamask: { provider: { type: 'ropsten' } },
|
metamask: { provider: { type: 'ropsten' } },
|
||||||
}))
|
}))
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(0).args,
|
mockDistpatch.getCall(0).args,
|
||||||
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
|
[{ type: GAS_ESTIMATE_LOADING_STARTED } ],
|
||||||
)
|
)
|
||||||
assert.equal(window.fetch.callCount, 0)
|
assert.equal(window.fetch.callCount, 0)
|
||||||
|
|
||||||
@ -643,11 +643,11 @@ describe('Gas Duck', function () {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
}]
|
}],
|
||||||
)
|
)
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
mockDistpatch.getCall(2).args,
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
gasEstimatesLoadingStarted(),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
gasEstimatesLoadingFinished(),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setPricesAndTimeEstimates('mockPricesAndTimeEstimates'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setBasicGasEstimateData('mockBasicEstimatData'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setCustomGasPrice('mockCustomGasPrice'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setCustomGasLimit('mockCustomGasLimit'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setCustomGasTotal('mockCustomGasTotal'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setCustomGasErrors('mockErrorObject'),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
setApiEstimatesLastRetrieved(1234),
|
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 () {
|
it('should create the correct action', function () {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
resetCustomGasState(),
|
resetCustomGasState(),
|
||||||
{ type: RESET_CUSTOM_GAS_STATE }
|
{ type: RESET_CUSTOM_GAS_STATE },
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -194,7 +194,7 @@ async function queryEthGasStationPredictionTable () {
|
|||||||
'referrerPolicy': 'no-referrer-when-downgrade',
|
'referrerPolicy': 'no-referrer-when-downgrade',
|
||||||
'body': null,
|
'body': null,
|
||||||
'method': 'GET',
|
'method': 'GET',
|
||||||
'mode': 'cors' }
|
'mode': 'cors' },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ export function fetchGasEstimates (blockTime) {
|
|||||||
})
|
})
|
||||||
: Promise.resolve(priceAndTimeEstimates.length
|
: Promise.resolve(priceAndTimeEstimates.length
|
||||||
? priceAndTimeEstimates
|
? priceAndTimeEstimates
|
||||||
: loadLocalStorageData('GAS_API_ESTIMATES')
|
: loadLocalStorageData('GAS_API_ESTIMATES'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return promiseToFetch.then((estimates) => {
|
return promiseToFetch.then((estimates) => {
|
||||||
|
@ -27,7 +27,7 @@ describe('withModalProps', function () {
|
|||||||
const WrappedComponent = withModalProps(TestComponent)
|
const WrappedComponent = withModalProps(TestComponent)
|
||||||
const store = configureMockStore()(mockState)
|
const store = configureMockStore()(mockState)
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<WrappedComponent store={store} />
|
<WrappedComponent store={store} />,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.ok(wrapper)
|
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 () {
|
it('should return true if the first value is greater than the second value', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.hexGreaterThan('0xb', '0xa'),
|
utils.hexGreaterThan('0xb', '0xa'),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the first value is less than the second value', function () {
|
it('should return false if the first value is less than the second value', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.hexGreaterThan('0xa', '0xb'),
|
utils.hexGreaterThan('0xa', '0xb'),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the first value is equal to the second value', function () {
|
it('should return false if the first value is equal to the second value', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.hexGreaterThan('0xa', '0xa'),
|
utils.hexGreaterThan('0xa', '0xa'),
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should correctly compare prefixed and non-prefixed hex values', function () {
|
it('should correctly compare prefixed and non-prefixed hex values', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.hexGreaterThan('0xb', 'a'),
|
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 () {
|
it('should multiply the hex gasLimit and hex gasPrice values together', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }),
|
utils.getHexGasTotal({ gasLimit: '0x5208', gasPrice: '0x3b9aca00' }),
|
||||||
'0x1319718a5000'
|
'0x1319718a5000',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should prefix the result with 0x', function () {
|
it('should prefix the result with 0x', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.getHexGasTotal({ gasLimit: '5208', gasPrice: '3b9aca00' }),
|
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 () {
|
it('should add two values together rounding to 6 decimal places', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.addEth('0.12345678', '0'),
|
utils.addEth('0.12345678', '0'),
|
||||||
'0.123457'
|
'0.123457',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should add any number of values together rounding to 6 decimal places', function () {
|
it('should add any number of values together rounding to 6 decimal places', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.addEth('0.1', '0.02', '0.003', '0.0004', '0.00005', '0.000006', '0.0000007'),
|
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 () {
|
it('should add two values together rounding to 2 decimal places', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.addFiat('0.12345678', '0'),
|
utils.addFiat('0.12345678', '0'),
|
||||||
'0.12'
|
'0.12',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should add any number of values together rounding to 2 decimal places', function () {
|
it('should add any number of values together rounding to 2 decimal places', function () {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
utils.addFiat('0.1', '0.02', '0.003', '0.0004', '0.00005', '0.000006', '0.0000007'),
|
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(
|
const firstIsGreater = conversionGreaterThan(
|
||||||
{ ...firstProps },
|
{ ...firstProps },
|
||||||
{ ...secondProps }
|
{ ...secondProps },
|
||||||
)
|
)
|
||||||
|
|
||||||
return firstIsGreater ? firstProps.value : secondProps.value
|
return firstIsGreater ? firstProps.value : secondProps.value
|
||||||
|
@ -160,7 +160,7 @@ export function getFormattedTokenFiatAmount (
|
|||||||
conversionRate,
|
conversionRate,
|
||||||
currentCurrency,
|
currentCurrency,
|
||||||
tokenAmount,
|
tokenAmount,
|
||||||
tokenSymbol
|
tokenSymbol,
|
||||||
) {
|
) {
|
||||||
// If the conversionRate is 0 (i.e. unknown) or the contract exchange rate
|
// 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
|
// is currently unknown, the fiat amount cannot be calculated so it is not
|
||||||
@ -171,7 +171,7 @@ export function getFormattedTokenFiatAmount (
|
|||||||
|
|
||||||
const currentTokenToFiatRate = multiplyCurrencies(
|
const currentTokenToFiatRate = multiplyCurrencies(
|
||||||
contractExchangeRate,
|
contractExchangeRate,
|
||||||
conversionRate
|
conversionRate,
|
||||||
)
|
)
|
||||||
const currentTokenInFiat = conversionUtil(tokenAmount, {
|
const currentTokenInFiat = conversionUtil(tokenAmount, {
|
||||||
fromNumericBase: 'dec',
|
fromNumericBase: 'dec',
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user