mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
colocate tests in flat structure (#10655)
This commit is contained in:
parent
da90674f59
commit
5a233e4634
@ -180,7 +180,11 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['development/**/*.js', 'test/e2e/benchmark.js', 'test/helper.js'],
|
files: [
|
||||||
|
'development/**/*.js',
|
||||||
|
'test/e2e/benchmark.js',
|
||||||
|
'test/helpers/setup-helper.js',
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'node/no-process-exit': 'off',
|
'node/no-process-exit': 'off',
|
||||||
'node/shebang': 'off',
|
'node/shebang': 'off',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import ethUtil from 'ethereumjs-util';
|
import ethUtil from 'ethereumjs-util';
|
||||||
import accountImporter from '../../../app/scripts/account-import-strategies';
|
import accountImporter from '.';
|
||||||
|
|
||||||
describe('Account Import Strategies', function () {
|
describe('Account Import Strategies', function () {
|
||||||
const privkey =
|
const privkey =
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import CachedBalancesController from '../../../../app/scripts/controllers/cached-balances';
|
import { KOVAN_CHAIN_ID } from '../../../shared/constants/network';
|
||||||
import { KOVAN_CHAIN_ID } from '../../../../shared/constants/network';
|
import CachedBalancesController from './cached-balances';
|
||||||
|
|
||||||
describe('CachedBalancesController', function () {
|
describe('CachedBalancesController', function () {
|
||||||
describe('updateCachedBalances', function () {
|
describe('updateCachedBalances', function () {
|
@ -4,10 +4,10 @@ import { ObservableStore } from '@metamask/obs-store';
|
|||||||
import contracts from '@metamask/contract-metadata';
|
import contracts from '@metamask/contract-metadata';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import DetectTokensController from '../../../../app/scripts/controllers/detect-tokens';
|
import { MAINNET, ROPSTEN } from '../../../shared/constants/network';
|
||||||
import NetworkController from '../../../../app/scripts/controllers/network/network';
|
import DetectTokensController from './detect-tokens';
|
||||||
import PreferencesController from '../../../../app/scripts/controllers/preferences';
|
import NetworkController from './network';
|
||||||
import { MAINNET, ROPSTEN } from '../../../../shared/constants/network';
|
import PreferencesController from './preferences';
|
||||||
|
|
||||||
describe('DetectTokensController', function () {
|
describe('DetectTokensController', function () {
|
||||||
const sandbox = sinon.createSandbox();
|
const sandbox = sinon.createSandbox();
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import EnsController from '../../../../app/scripts/controllers/ens';
|
import EnsController from '.';
|
||||||
|
|
||||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||||
const ZERO_X_ERROR_ADDRESS = '0x';
|
const ZERO_X_ERROR_ADDRESS = '0x';
|
@ -4,7 +4,7 @@ import proxyquire from 'proxyquire';
|
|||||||
import nock from 'nock';
|
import nock from 'nock';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
|
|
||||||
import waitUntilCalled from '../../../lib/wait-until-called';
|
import waitUntilCalled from '../../../test/lib/wait-until-called';
|
||||||
import {
|
import {
|
||||||
GOERLI,
|
GOERLI,
|
||||||
KOVAN,
|
KOVAN,
|
||||||
@ -14,19 +14,16 @@ import {
|
|||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
ROPSTEN_NETWORK_ID,
|
ROPSTEN_NETWORK_ID,
|
||||||
} from '../../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
import {
|
import {
|
||||||
TRANSACTION_TYPES,
|
TRANSACTION_TYPES,
|
||||||
TRANSACTION_STATUSES,
|
TRANSACTION_STATUSES,
|
||||||
} from '../../../../shared/constants/transaction';
|
} from '../../../shared/constants/transaction';
|
||||||
import { NETWORK_EVENTS } from '../../../../app/scripts/controllers/network';
|
import { NETWORK_EVENTS } from './network';
|
||||||
|
|
||||||
const IncomingTransactionsController = proxyquire(
|
const IncomingTransactionsController = proxyquire('./incoming-transactions', {
|
||||||
'../../../../app/scripts/controllers/incoming-transactions',
|
'../lib/random-id': { default: () => 54321 },
|
||||||
{
|
}).default;
|
||||||
'../lib/random-id': { default: () => 54321 },
|
|
||||||
},
|
|
||||||
).default;
|
|
||||||
|
|
||||||
const FAKE_CHAIN_ID = '0x1338';
|
const FAKE_CHAIN_ID = '0x1338';
|
||||||
const MOCK_SELECTED_ADDRESS = '0x0101';
|
const MOCK_SELECTED_ADDRESS = '0x0101';
|
@ -1,14 +1,14 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import MetaMetricsController from '../../../../app/scripts/controllers/metametrics';
|
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../shared/constants/app';
|
||||||
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../../shared/constants/app';
|
import { createSegmentMock } from '../lib/segment';
|
||||||
import { createSegmentMock } from '../../../../app/scripts/lib/segment';
|
|
||||||
import {
|
import {
|
||||||
METAMETRICS_ANONYMOUS_ID,
|
METAMETRICS_ANONYMOUS_ID,
|
||||||
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
||||||
} from '../../../../shared/constants/metametrics';
|
} from '../../../shared/constants/metametrics';
|
||||||
import waitUntilCalled from '../../../lib/wait-until-called';
|
import waitUntilCalled from '../../../test/lib/wait-until-called';
|
||||||
import { NETWORK_EVENTS } from '../../../../app/scripts/controllers/network';
|
import MetaMetricsController from './metametrics';
|
||||||
|
import { NETWORK_EVENTS } from './network';
|
||||||
|
|
||||||
const segment = createSegmentMock(2, 10000);
|
const segment = createSegmentMock(2, 10000);
|
||||||
const segmentLegacy = createSegmentMock(2, 10000);
|
const segmentLegacy = createSegmentMock(2, 10000);
|
@ -1,7 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import NetworkController from '../../../../../app/scripts/controllers/network';
|
import { getNetworkDisplayName } from './util';
|
||||||
import { getNetworkDisplayName } from '../../../../../app/scripts/controllers/network/util';
|
import NetworkController from './network';
|
||||||
|
|
||||||
describe('NetworkController', function () {
|
describe('NetworkController', function () {
|
||||||
describe('controller', function () {
|
describe('controller', function () {
|
@ -1,9 +1,9 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
import { txMetaStub } from '../../../../test/stub/tx-meta-stub';
|
||||||
import {
|
import {
|
||||||
createPendingNonceMiddleware,
|
createPendingNonceMiddleware,
|
||||||
createPendingTxMiddleware,
|
createPendingTxMiddleware,
|
||||||
} from '../../../../../app/scripts/controllers/network/middleware/pending';
|
} from './middleware/pending';
|
||||||
import { txMetaStub } from './stubs';
|
|
||||||
|
|
||||||
describe('PendingNonceMiddleware', function () {
|
describe('PendingNonceMiddleware', function () {
|
||||||
describe('#createPendingNonceMiddleware', function () {
|
describe('#createPendingNonceMiddleware', function () {
|
@ -2,22 +2,20 @@ import { strict as assert } from 'assert';
|
|||||||
import { find } from 'lodash';
|
import { find } from 'lodash';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
||||||
import {
|
|
||||||
METADATA_STORE_KEY,
|
|
||||||
METADATA_CACHE_MAX_SIZE,
|
|
||||||
} from '../../../../../app/scripts/controllers/permissions/enums';
|
|
||||||
|
|
||||||
import { PermissionsController } from '../../../../../app/scripts/controllers/permissions';
|
|
||||||
|
|
||||||
import { getRequestUserApprovalHelper, grantPermissions } from './helpers';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
constants,
|
constants,
|
||||||
getters,
|
getters,
|
||||||
getNotifyDomain,
|
getNotifyDomain,
|
||||||
getNotifyAllDomains,
|
getNotifyAllDomains,
|
||||||
getPermControllerOpts,
|
getPermControllerOpts,
|
||||||
} from './mocks';
|
} from '../../../../test/mocks/permission-controller';
|
||||||
|
import {
|
||||||
|
getRequestUserApprovalHelper,
|
||||||
|
grantPermissions,
|
||||||
|
} from '../../../../test/helpers/permission-controller-helpers';
|
||||||
|
import { METADATA_STORE_KEY, METADATA_CACHE_MAX_SIZE } from './enums';
|
||||||
|
|
||||||
|
import { PermissionsController } from '.';
|
||||||
|
|
||||||
const { ERRORS, NOTIFICATIONS, PERMS } = getters;
|
const { ERRORS, NOTIFICATIONS, PERMS } = getters;
|
||||||
|
|
@ -3,16 +3,14 @@ import { ObservableStore } from '@metamask/obs-store';
|
|||||||
import nanoid from 'nanoid';
|
import nanoid from 'nanoid';
|
||||||
import { useFakeTimers } from 'sinon';
|
import { useFakeTimers } from 'sinon';
|
||||||
|
|
||||||
import PermissionsLogController from '../../../../../app/scripts/controllers/permissions/permissionsLog';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
LOG_LIMIT,
|
constants,
|
||||||
LOG_METHOD_TYPES,
|
getters,
|
||||||
} from '../../../../../app/scripts/controllers/permissions/enums';
|
noop,
|
||||||
|
} from '../../../../test/mocks/permission-controller';
|
||||||
import { validateActivityEntry } from './helpers';
|
import { validateActivityEntry } from '../../../../test/helpers/permission-controller-helpers';
|
||||||
|
import PermissionsLogController from './permissionsLog';
|
||||||
import { constants, getters, noop } from './mocks';
|
import { LOG_LIMIT, LOG_METHOD_TYPES } from './enums';
|
||||||
|
|
||||||
const { PERMS, RPC_REQUESTS } = getters;
|
const { PERMS, RPC_REQUESTS } = getters;
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ const initMiddleware = (permLog) => {
|
|||||||
const initClock = () => {
|
const initClock = () => {
|
||||||
// useFakeTimers, is in fact, not a react-hook
|
// useFakeTimers, is in fact, not a react-hook
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
clock = useFakeTimers(1)
|
clock = useFakeTimers(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const tearDownClock = () => {
|
const tearDownClock = () => {
|
@ -1,18 +1,19 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
||||||
import { METADATA_STORE_KEY } from '../../../../../app/scripts/controllers/permissions/enums';
|
|
||||||
|
|
||||||
import { PermissionsController } from '../../../../../app/scripts/controllers/permissions';
|
|
||||||
|
|
||||||
import { getUserApprovalPromise, grantPermissions } from './helpers';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
constants,
|
constants,
|
||||||
getters,
|
getters,
|
||||||
getPermControllerOpts,
|
getPermControllerOpts,
|
||||||
getPermissionsMiddleware,
|
getPermissionsMiddleware,
|
||||||
} from './mocks';
|
} from '../../../../test/mocks/permission-controller';
|
||||||
|
import {
|
||||||
|
getUserApprovalPromise,
|
||||||
|
grantPermissions,
|
||||||
|
} from '../../../../test/helpers/permission-controller-helpers';
|
||||||
|
import { METADATA_STORE_KEY } from './enums';
|
||||||
|
|
||||||
|
import { PermissionsController } from '.';
|
||||||
|
|
||||||
const { CAVEATS, ERRORS, PERMS, RPC_REQUESTS } = getters;
|
const { CAVEATS, ERRORS, PERMS, RPC_REQUESTS } = getters;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import pify from 'pify';
|
import pify from 'pify';
|
||||||
|
|
||||||
import getRestrictedMethods from '../../../../../app/scripts/controllers/permissions/restrictedMethods';
|
import getRestrictedMethods from './restrictedMethods';
|
||||||
|
|
||||||
describe('restricted methods', function () {
|
describe('restricted methods', function () {
|
||||||
describe('eth_accounts', function () {
|
describe('eth_accounts', function () {
|
@ -1,10 +1,10 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import PreferencesController from '../../../../app/scripts/controllers/preferences';
|
|
||||||
import {
|
import {
|
||||||
MAINNET_CHAIN_ID,
|
MAINNET_CHAIN_ID,
|
||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
} from '../../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
|
import PreferencesController from './preferences';
|
||||||
|
|
||||||
describe('preferences controller', function () {
|
describe('preferences controller', function () {
|
||||||
let preferencesController;
|
let preferencesController;
|
@ -8,13 +8,11 @@ import { ObservableStore } from '@metamask/obs-store';
|
|||||||
import {
|
import {
|
||||||
ROPSTEN_NETWORK_ID,
|
ROPSTEN_NETWORK_ID,
|
||||||
MAINNET_NETWORK_ID,
|
MAINNET_NETWORK_ID,
|
||||||
} from '../../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
import { ETH_SWAPS_TOKEN_OBJECT } from '../../../../shared/constants/swaps';
|
import { ETH_SWAPS_TOKEN_OBJECT } from '../../../shared/constants/swaps';
|
||||||
import { createTestProviderTools } from '../../../stub/provider';
|
import { createTestProviderTools } from '../../../test/stub/provider';
|
||||||
import SwapsController, {
|
import SwapsController, { utils } from './swaps';
|
||||||
utils,
|
import { NETWORK_EVENTS } from './network';
|
||||||
} from '../../../../app/scripts/controllers/swaps';
|
|
||||||
import { NETWORK_EVENTS } from '../../../../app/scripts/controllers/network';
|
|
||||||
|
|
||||||
const MOCK_FETCH_PARAMS = {
|
const MOCK_FETCH_PARAMS = {
|
||||||
slippage: 3,
|
slippage: 3,
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { ObservableStore } from '@metamask/obs-store';
|
import { ObservableStore } from '@metamask/obs-store';
|
||||||
import TokenRatesController from '../../../../app/scripts/controllers/token-rates';
|
import TokenRatesController from './token-rates';
|
||||||
|
|
||||||
describe('TokenRatesController', function () {
|
describe('TokenRatesController', function () {
|
||||||
let nativeCurrency;
|
let nativeCurrency;
|
@ -4,17 +4,17 @@ import ethUtil from 'ethereumjs-util';
|
|||||||
import EthTx from 'ethereumjs-tx';
|
import EthTx from 'ethereumjs-tx';
|
||||||
import { ObservableStore } from '@metamask/obs-store';
|
import { ObservableStore } from '@metamask/obs-store';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import TransactionController from '../../../../../app/scripts/controllers/transactions';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createTestProviderTools,
|
createTestProviderTools,
|
||||||
getTestAccounts,
|
getTestAccounts,
|
||||||
} from '../../../../stub/provider';
|
} from '../../../../test/stub/provider';
|
||||||
import {
|
import {
|
||||||
TRANSACTION_STATUSES,
|
TRANSACTION_STATUSES,
|
||||||
TRANSACTION_TYPES,
|
TRANSACTION_TYPES,
|
||||||
} from '../../../../../shared/constants/transaction';
|
} from '../../../../shared/constants/transaction';
|
||||||
import { METAMASK_CONTROLLER_EVENTS } from '../../../../../app/scripts/metamask-controller';
|
import { METAMASK_CONTROLLER_EVENTS } from '../../metamask-controller';
|
||||||
|
import TransactionController from '.';
|
||||||
|
|
||||||
const noop = () => true;
|
const noop = () => true;
|
||||||
const currentNetworkId = '42';
|
const currentNetworkId = '42';
|
@ -1,11 +1,11 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
|
import testData from '../../../../../test/data/mock-tx-history.json';
|
||||||
import {
|
import {
|
||||||
snapshotFromTxMeta,
|
snapshotFromTxMeta,
|
||||||
migrateFromSnapshotsToDiffs,
|
migrateFromSnapshotsToDiffs,
|
||||||
replayHistory,
|
replayHistory,
|
||||||
generateHistoryEntry,
|
generateHistoryEntry,
|
||||||
} from '../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helpers';
|
} from './tx-state-history-helpers';
|
||||||
import testData from '../../../../data/mock-tx-history.json';
|
|
||||||
|
|
||||||
describe('Transaction state history helper', function () {
|
describe('Transaction state history helper', function () {
|
||||||
describe('#snapshotFromTxMeta', function () {
|
describe('#snapshotFromTxMeta', function () {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import * as txUtils from '../../../../../app/scripts/controllers/transactions/lib/util';
|
import * as txUtils from './util';
|
||||||
|
|
||||||
describe('txUtils', function () {
|
describe('txUtils', function () {
|
||||||
describe('#validateTxParams', function () {
|
describe('#validateTxParams', function () {
|
@ -1,8 +1,8 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import BN from 'bn.js';
|
import BN from 'bn.js';
|
||||||
import PendingTransactionTracker from '../../../../../app/scripts/controllers/transactions/pending-tx-tracker';
|
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
|
||||||
import { TRANSACTION_STATUSES } from '../../../../../shared/constants/transaction';
|
import PendingTransactionTracker from './pending-tx-tracker';
|
||||||
|
|
||||||
describe('PendingTransactionTracker', function () {
|
describe('PendingTransactionTracker', function () {
|
||||||
describe('#resubmitPendingTxs', function () {
|
describe('#resubmitPendingTxs', function () {
|
@ -1,7 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import Transaction from 'ethereumjs-tx';
|
import Transaction from 'ethereumjs-tx';
|
||||||
import { hexToBn, bnToHex } from '../../../../../app/scripts/lib/util';
|
import { hexToBn, bnToHex } from '../../lib/util';
|
||||||
import TxUtils from '../../../../../app/scripts/controllers/transactions/tx-gas-utils';
|
import TxUtils from './tx-gas-utils';
|
||||||
|
|
||||||
describe('txUtils', function () {
|
describe('txUtils', function () {
|
||||||
let txUtils;
|
let txUtils;
|
@ -1,12 +1,12 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import TxStateManager from '../../../../../app/scripts/controllers/transactions/tx-state-manager';
|
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
|
||||||
import { snapshotFromTxMeta } from '../../../../../app/scripts/controllers/transactions/lib/tx-state-history-helpers';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../../../shared/constants/transaction';
|
|
||||||
import {
|
import {
|
||||||
KOVAN_CHAIN_ID,
|
KOVAN_CHAIN_ID,
|
||||||
KOVAN_NETWORK_ID,
|
KOVAN_NETWORK_ID,
|
||||||
} from '../../../../../shared/constants/network';
|
} from '../../../../shared/constants/network';
|
||||||
|
import TxStateManager from './tx-state-manager';
|
||||||
|
import { snapshotFromTxMeta } from './lib/tx-state-history-helpers';
|
||||||
|
|
||||||
const noop = () => true;
|
const noop = () => true;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { ObservableStore } from '@metamask/obs-store';
|
import { ObservableStore } from '@metamask/obs-store';
|
||||||
import ComposableObservableStore from '../../../app/scripts/lib/ComposableObservableStore';
|
import ComposableObservableStore from './ComposableObservableStore';
|
||||||
|
|
||||||
describe('ComposableObservableStore', function () {
|
describe('ComposableObservableStore', function () {
|
||||||
it('should register initial state', function () {
|
it('should register initial state', function () {
|
@ -1,11 +1,11 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import getBuyEthUrl from '../../../app/scripts/lib/buy-eth-url';
|
|
||||||
import {
|
import {
|
||||||
KOVAN_CHAIN_ID,
|
KOVAN_CHAIN_ID,
|
||||||
MAINNET_CHAIN_ID,
|
MAINNET_CHAIN_ID,
|
||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
} from '../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
|
import getBuyEthUrl from './buy-eth-url';
|
||||||
|
|
||||||
describe('buy-eth-url', function () {
|
describe('buy-eth-url', function () {
|
||||||
const mainnet = {
|
const mainnet = {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import cleanErrorStack from '../../../app/scripts/lib/cleanErrorStack';
|
import cleanErrorStack from './cleanErrorStack';
|
||||||
|
|
||||||
describe('Clean Error Stack', function () {
|
describe('Clean Error Stack', function () {
|
||||||
const testMessage = 'Test Message';
|
const testMessage = 'Test Message';
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import MessageManager from '../../../app/scripts/lib/message-manager';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import MessageManager from './message-manager';
|
||||||
|
|
||||||
describe('Message Manager', function () {
|
describe('Message Manager', function () {
|
||||||
let messageManager;
|
let messageManager;
|
@ -1,9 +1,9 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import Migrator from '../../../app/scripts/lib/migrator';
|
import liveMigrations from '../../migrations';
|
||||||
import liveMigrations from '../../../app/scripts/migrations';
|
import data from '../../first-time-state';
|
||||||
import data from '../../../app/scripts/first-time-state';
|
import Migrator from '.';
|
||||||
|
|
||||||
const stubMigrations = [
|
const stubMigrations = [
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ describe('migrations', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should have tests for all migrations', function () {
|
it('should have tests for all migrations', function () {
|
||||||
const fileNames = fs.readdirSync('./test/unit/migrations/');
|
const fileNames = fs.readdirSync('./app/scripts/migrations/');
|
||||||
const testNumbers = fileNames
|
const testNumbers = fileNames
|
||||||
.reduce((acc, filename) => {
|
.reduce((acc, filename) => {
|
||||||
const name = filename.split('.test.')[0];
|
const name = filename.split('.test.')[0];
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import nodeify from '../../../app/scripts/lib/nodeify';
|
import nodeify from './nodeify';
|
||||||
|
|
||||||
describe('nodeify', function () {
|
describe('nodeify', function () {
|
||||||
const obj = {
|
const obj = {
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import PersonalMessageManager from '../../../app/scripts/lib/personal-message-manager';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import PersonalMessageManager from './personal-message-manager';
|
||||||
|
|
||||||
describe('Personal Message Manager', function () {
|
describe('Personal Message Manager', function () {
|
||||||
let messageManager;
|
let messageManager;
|
@ -1,9 +1,9 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import KeyringController from 'eth-keyring-controller';
|
import KeyringController from 'eth-keyring-controller';
|
||||||
import firstTimeState from '../../../app/scripts/first-time-state';
|
import firstTimeState from '../first-time-state';
|
||||||
import seedPhraseVerifier from '../../../app/scripts/lib/seed-phrase-verifier';
|
import mockEncryptor from '../../../test/lib/mock-encryptor';
|
||||||
import mockEncryptor from '../../lib/mock-encryptor';
|
import seedPhraseVerifier from './seed-phrase-verifier';
|
||||||
|
|
||||||
describe('SeedPhraseVerifier', function () {
|
describe('SeedPhraseVerifier', function () {
|
||||||
describe('verifyAccounts', function () {
|
describe('verifyAccounts', function () {
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import TypedMessageManager from '../../../app/scripts/lib/typed-message-manager';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import TypedMessageManager from './typed-message-manager';
|
||||||
|
|
||||||
describe('Typed Message Manager', function () {
|
describe('Typed Message Manager', function () {
|
||||||
let typedMessageManager,
|
let typedMessageManager,
|
@ -1,8 +1,4 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import {
|
|
||||||
getEnvironmentType,
|
|
||||||
sufficientBalance,
|
|
||||||
} from '../../../app/scripts/lib/util';
|
|
||||||
import { isPrefixedFormattedHexString } from '../../../shared/modules/network.utils';
|
import { isPrefixedFormattedHexString } from '../../../shared/modules/network.utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -11,6 +7,7 @@ import {
|
|||||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
ENVIRONMENT_TYPE_FULLSCREEN,
|
||||||
ENVIRONMENT_TYPE_BACKGROUND,
|
ENVIRONMENT_TYPE_BACKGROUND,
|
||||||
} from '../../../shared/constants/app';
|
} from '../../../shared/constants/app';
|
||||||
|
import { getEnvironmentType, sufficientBalance } from './util';
|
||||||
|
|
||||||
describe('app utils', function () {
|
describe('app utils', function () {
|
||||||
describe('getEnvironmentType', function () {
|
describe('getEnvironmentType', function () {
|
@ -6,12 +6,23 @@ import ethUtil from 'ethereumjs-util';
|
|||||||
import { obj as createThoughStream } from 'through2';
|
import { obj as createThoughStream } from 'through2';
|
||||||
import EthQuery from 'eth-query';
|
import EthQuery from 'eth-query';
|
||||||
import proxyquire from 'proxyquire';
|
import proxyquire from 'proxyquire';
|
||||||
import firstTimeState from '../../localhostState';
|
import { TRANSACTION_STATUSES } from '../../shared/constants/transaction';
|
||||||
import createTxMeta from '../../../lib/createTxMeta';
|
import createTxMeta from '../../test/lib/createTxMeta';
|
||||||
import { addHexPrefix } from '../../../../app/scripts/lib/util';
|
import { NETWORK_TYPE_RPC } from '../../shared/constants/network';
|
||||||
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
|
import { addHexPrefix } from './lib/util';
|
||||||
|
|
||||||
const Ganache = require('../../../e2e/ganache');
|
const Ganache = require('../../test/e2e/ganache');
|
||||||
|
|
||||||
|
const firstTimeState = {
|
||||||
|
config: {},
|
||||||
|
NetworkController: {
|
||||||
|
provider: {
|
||||||
|
type: NETWORK_TYPE_RPC,
|
||||||
|
rpcUrl: 'http://localhost:8545',
|
||||||
|
chainId: '0x539',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const ganacheServer = new Ganache();
|
const ganacheServer = new Ganache();
|
||||||
|
|
||||||
@ -67,13 +78,10 @@ const createLoggerMiddlewareMock = () => (req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
||||||
const MetaMaskController = proxyquire(
|
const MetaMaskController = proxyquire('./metamask-controller', {
|
||||||
'../../../../app/scripts/metamask-controller',
|
'./controllers/threebox': { default: ThreeBoxControllerMock },
|
||||||
{
|
'./lib/createLoggerMiddleware': { default: createLoggerMiddlewareMock },
|
||||||
'./controllers/threebox': { default: ThreeBoxControllerMock },
|
}).default;
|
||||||
'./lib/createLoggerMiddleware': { default: createLoggerMiddlewareMock },
|
|
||||||
},
|
|
||||||
).default;
|
|
||||||
|
|
||||||
const currentNetworkId = '42';
|
const currentNetworkId = '42';
|
||||||
const DEFAULT_LABEL = 'Account 1';
|
const DEFAULT_LABEL = 'Account 1';
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import wallet2 from '../../lib/migrations/002.json';
|
import wallet2 from '../../../test/lib/migrations/002.json';
|
||||||
import migration21 from '../../../app/scripts/migrations/021';
|
import migration21 from './021';
|
||||||
|
|
||||||
describe('wallet2 is migrated successfully with out the BlacklistController', function () {
|
describe('wallet2 is migrated successfully with out the BlacklistController', function () {
|
||||||
it('should delete BlacklistController key', function (done) {
|
it('should delete BlacklistController key', function (done) {
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration22 from '../../../app/scripts/migrations/022';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration22 from './022';
|
||||||
|
|
||||||
const properTime = new Date().getTime();
|
const properTime = new Date().getTime();
|
||||||
const storage = {
|
const storage = {
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration23 from '../../../app/scripts/migrations/023';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration23 from './023';
|
||||||
|
|
||||||
const storage = {
|
const storage = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration24 from '../../../app/scripts/migrations/024';
|
import data from '../first-time-state';
|
||||||
import data from '../../../app/scripts/first-time-state';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration24 from './024';
|
||||||
|
|
||||||
const firstTimeState = {
|
const firstTimeState = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration25 from '../../../app/scripts/migrations/025';
|
import data from '../first-time-state';
|
||||||
import data from '../../../app/scripts/first-time-state';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration25 from './025';
|
||||||
|
|
||||||
const firstTimeState = {
|
const firstTimeState = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import firstTimeState from '../../../app/scripts/first-time-state';
|
import firstTimeState from '../first-time-state';
|
||||||
import migration26 from '../../../app/scripts/migrations/026';
|
import migration26 from './026';
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: { version: 25 },
|
meta: { version: 25 },
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import firstTimeState from '../../../app/scripts/first-time-state';
|
import firstTimeState from '../first-time-state';
|
||||||
import migration27 from '../../../app/scripts/migrations/027';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration27 from './027';
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import firstTimeState from '../../../app/scripts/first-time-state';
|
import firstTimeState from '../first-time-state';
|
||||||
import migration28 from '../../../app/scripts/migrations/028';
|
import migration28 from './028';
|
||||||
|
|
||||||
const oldStorage = {
|
const oldStorage = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,6 +1,6 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration29 from '../../../app/scripts/migrations/029';
|
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction';
|
||||||
|
import migration29 from './029';
|
||||||
|
|
||||||
const properTime = new Date().getTime();
|
const properTime = new Date().getTime();
|
||||||
const storage = {
|
const storage = {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migrationTemplate from '../../../app/scripts/migrations/030';
|
import migrationTemplate from './030';
|
||||||
|
|
||||||
const storage = {
|
const storage = {
|
||||||
meta: {},
|
meta: {},
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration31 from '../../../app/scripts/migrations/031';
|
import migration31 from './031';
|
||||||
|
|
||||||
describe('migration #31', function () {
|
describe('migration #31', function () {
|
||||||
it('should set completedOnboarding to true if vault exists', function (done) {
|
it('should set completedOnboarding to true if vault exists', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration33 from '../../../app/scripts/migrations/033';
|
import migration33 from './033';
|
||||||
|
|
||||||
describe('Migration to delete notice controller', function () {
|
describe('Migration to delete notice controller', function () {
|
||||||
const oldStorage = {
|
const oldStorage = {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration34 from '../../../app/scripts/migrations/034';
|
import migration34 from './034';
|
||||||
|
|
||||||
describe('migration #34', function () {
|
describe('migration #34', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration35 from '../../../app/scripts/migrations/035';
|
import migration35 from './035';
|
||||||
|
|
||||||
describe('migration #35', function () {
|
describe('migration #35', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration36 from '../../../app/scripts/migrations/036';
|
import migration36 from './036';
|
||||||
|
|
||||||
describe('migration #36', function () {
|
describe('migration #36', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration37 from '../../../app/scripts/migrations/037';
|
import migration37 from './037';
|
||||||
|
|
||||||
describe('migration #37', function () {
|
describe('migration #37', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration38 from '../../../app/scripts/migrations/038';
|
import migration38 from './038';
|
||||||
|
|
||||||
describe('migration #38', function () {
|
describe('migration #38', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration39 from '../../../app/scripts/migrations/039';
|
import migration39 from './039';
|
||||||
|
|
||||||
describe('migration #39', function () {
|
describe('migration #39', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration40 from '../../../app/scripts/migrations/040';
|
import migration40 from './040';
|
||||||
|
|
||||||
describe('migration #40', function () {
|
describe('migration #40', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration41 from '../../../app/scripts/migrations/041';
|
import migration41 from './041';
|
||||||
|
|
||||||
describe('migration #41', function () {
|
describe('migration #41', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration42 from '../../../app/scripts/migrations/042';
|
import migration42 from './042';
|
||||||
|
|
||||||
describe('migration #42', function () {
|
describe('migration #42', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration43 from '../../../app/scripts/migrations/043';
|
import migration43 from './043';
|
||||||
|
|
||||||
describe('migration #43', function () {
|
describe('migration #43', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration44 from '../../../app/scripts/migrations/044';
|
import migration44 from './044';
|
||||||
|
|
||||||
describe('migration #44', function () {
|
describe('migration #44', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration45 from '../../../app/scripts/migrations/045';
|
import migration45 from './045';
|
||||||
|
|
||||||
describe('migration #45', function () {
|
describe('migration #45', function () {
|
||||||
it('should update the version metadata', function (done) {
|
it('should update the version metadata', function (done) {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration46 from '../../../app/scripts/migrations/046';
|
import migration46 from './046';
|
||||||
|
|
||||||
describe('migration #46', function () {
|
describe('migration #46', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration47 from '../../../app/scripts/migrations/047';
|
import migration47 from './047';
|
||||||
|
|
||||||
describe('migration #47', function () {
|
describe('migration #47', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,5 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration48 from '../../../app/scripts/migrations/048';
|
import migration48 from './048';
|
||||||
|
|
||||||
const localhostNetwork = {
|
const localhostNetwork = {
|
||||||
rpcUrl: 'http://localhost:8545',
|
rpcUrl: 'http://localhost:8545',
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration49 from '../../../app/scripts/migrations/049';
|
import migration49 from './049';
|
||||||
|
|
||||||
describe('migration #49', function () {
|
describe('migration #49', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,6 +1,6 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import migration50 from '../../../app/scripts/migrations/050';
|
import migration50 from './050';
|
||||||
|
|
||||||
const LEGACY_LOCAL_STORAGE_KEYS = [
|
const LEGACY_LOCAL_STORAGE_KEYS = [
|
||||||
'METASWAP_GAS_PRICE_ESTIMATES_LAST_RETRIEVED',
|
'METASWAP_GAS_PRICE_ESTIMATES_LAST_RETRIEVED',
|
@ -1,9 +1,9 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration51 from '../../../app/scripts/migrations/051';
|
|
||||||
import {
|
import {
|
||||||
INFURA_PROVIDER_TYPES,
|
INFURA_PROVIDER_TYPES,
|
||||||
NETWORK_TYPE_TO_ID_MAP,
|
NETWORK_TYPE_TO_ID_MAP,
|
||||||
} from '../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
|
import migration51 from './051';
|
||||||
|
|
||||||
describe('migration #51', function () {
|
describe('migration #51', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,5 +1,4 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migration52 from '../../../app/scripts/migrations/052';
|
|
||||||
import {
|
import {
|
||||||
GOERLI,
|
GOERLI,
|
||||||
GOERLI_CHAIN_ID,
|
GOERLI_CHAIN_ID,
|
||||||
@ -13,6 +12,7 @@ import {
|
|||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
} from '../../../shared/constants/network';
|
} from '../../../shared/constants/network';
|
||||||
|
import migration52 from './052';
|
||||||
|
|
||||||
const TOKEN1 = { symbol: 'TST', address: '0x10', decimals: 18 };
|
const TOKEN1 = { symbol: 'TST', address: '0x10', decimals: 18 };
|
||||||
const TOKEN2 = { symbol: 'TXT', address: '0x11', decimals: 18 };
|
const TOKEN2 = { symbol: 'TXT', address: '0x11', decimals: 18 };
|
@ -1,6 +1,6 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import migration53 from '../../../app/scripts/migrations/053';
|
|
||||||
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
|
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
|
||||||
|
import migration53 from './053';
|
||||||
|
|
||||||
describe('migration #53', function () {
|
describe('migration #53', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
@ -1,18 +1,18 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import wallet1 from '../../lib/migrations/001.json';
|
import wallet1 from '../../../test/lib/migrations/001.json';
|
||||||
import vault4 from '../../lib/migrations/004.json';
|
import vault4 from '../../../test/lib/migrations/004.json';
|
||||||
import migration2 from '../../../app/scripts/migrations/002';
|
import migration2 from './002';
|
||||||
import migration3 from '../../../app/scripts/migrations/003';
|
import migration3 from './003';
|
||||||
import migration4 from '../../../app/scripts/migrations/004';
|
import migration4 from './004';
|
||||||
import migration5 from '../../../app/scripts/migrations/005';
|
import migration5 from './005';
|
||||||
import migration6 from '../../../app/scripts/migrations/006';
|
import migration6 from './006';
|
||||||
import migration7 from '../../../app/scripts/migrations/007';
|
import migration7 from './007';
|
||||||
import migration8 from '../../../app/scripts/migrations/008';
|
import migration8 from './008';
|
||||||
import migration9 from '../../../app/scripts/migrations/009';
|
import migration9 from './009';
|
||||||
import migration10 from '../../../app/scripts/migrations/010';
|
import migration10 from './010';
|
||||||
import migration11 from '../../../app/scripts/migrations/011';
|
import migration11 from './011';
|
||||||
import migration12 from '../../../app/scripts/migrations/012';
|
import migration12 from './012';
|
||||||
import migration13 from '../../../app/scripts/migrations/013';
|
import migration13 from './013';
|
||||||
|
|
||||||
let vault5, vault6, vault7, vault8, vault9; // vault10, vault11
|
let vault5, vault6, vault7, vault8, vault9; // vault10, vault11
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import migrationTemplate from '../../../app/scripts/migrations/template';
|
import migrationTemplate from './template';
|
||||||
|
|
||||||
const storage = {
|
const storage = {
|
||||||
meta: {},
|
meta: {},
|
@ -20,10 +20,10 @@
|
|||||||
"forwarder": "node ./development/static-server.js ./node_modules/@metamask/forwarder/dist/ --port 9010",
|
"forwarder": "node ./development/static-server.js ./node_modules/@metamask/forwarder/dist/ --port 9010",
|
||||||
"dapp-forwarder": "concurrently -k -n forwarder,dapp -p '[{time}][{name}]' 'yarn forwarder' 'yarn dapp'",
|
"dapp-forwarder": "concurrently -k -n forwarder,dapp -p '[{time}][{name}]' 'yarn forwarder' 'yarn dapp'",
|
||||||
"sendwithprivatedapp": "node development/static-server.js test/e2e/send-eth-with-private-key-test --port 8080",
|
"sendwithprivatedapp": "node development/static-server.js test/e2e/send-eth-with-private-key-test --port 8080",
|
||||||
"test:unit": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/**/*.test.js\" \"ui/app/**/*.test.js\" \"shared/**/*.test.js\"",
|
"test:unit": "mocha --exit --require test/env.js --require test/setup.js --recursive './{ui,app,shared}/**/*.test.js'",
|
||||||
"test:unit:global": "mocha --exit --require test/env.js --require test/setup.js --recursive test/unit-global/*.test.js",
|
"test:unit:global": "mocha --exit --require test/env.js --require test/setup.js --recursive test/unit-global/*.test.js",
|
||||||
"test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/{,**/!(permissions)}/*.test.js\" \"ui/app/**/*.test.js\" \"shared/**/*.test.js\"",
|
"test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive './{ui,app,shared}/{,**/!(permissions)}/*.test.js'",
|
||||||
"test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/**/permissions/*.test.js\"",
|
"test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive 'app/scripts/controllers/permissions/*.test.js'",
|
||||||
"test:unit:path": "mocha --exit --require test/env.js --require test/setup.js --recursive",
|
"test:unit:path": "mocha --exit --require test/env.js --require test/setup.js --recursive",
|
||||||
"test:e2e:chrome": "SELENIUM_BROWSER=chrome test/e2e/run-all.sh",
|
"test:e2e:chrome": "SELENIUM_BROWSER=chrome test/e2e/run-all.sh",
|
||||||
"test:e2e:chrome:metrics": "SELENIUM_BROWSER=chrome mocha test/e2e/metrics.spec.js",
|
"test:e2e:chrome:metrics": "SELENIUM_BROWSER=chrome mocha test/e2e/metrics.spec.js",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import nock from 'nock';
|
import nock from 'nock';
|
||||||
|
|
||||||
import getFetchWithTimeout from '../../../shared/modules/fetch-with-timeout';
|
import getFetchWithTimeout from './fetch-with-timeout';
|
||||||
|
|
||||||
describe('getFetchWithTimeout', function () {
|
describe('getFetchWithTimeout', function () {
|
||||||
it('fetches a url', async function () {
|
it('fetches a url', async function () {
|
@ -1,7 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import stringify from 'fast-safe-stringify';
|
import stringify from 'fast-safe-stringify';
|
||||||
|
|
||||||
import { noop } from './mocks';
|
import { noop } from '../mocks/permission-controller';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grants the given permissions to the given origin, using the given permissions
|
* Grants the given permissions to the given origin, using the given permissions
|
@ -3,13 +3,13 @@ import deepFreeze from 'deep-freeze-strict';
|
|||||||
|
|
||||||
import { ApprovalController } from '@metamask/controllers';
|
import { ApprovalController } from '@metamask/controllers';
|
||||||
|
|
||||||
import _getRestrictedMethods from '../../../../../app/scripts/controllers/permissions/restrictedMethods';
|
import _getRestrictedMethods from '../../app/scripts/controllers/permissions/restrictedMethods';
|
||||||
|
|
||||||
import { CAVEAT_NAMES } from '../../../../../shared/constants/permissions';
|
import { CAVEAT_NAMES } from '../../shared/constants/permissions';
|
||||||
import {
|
import {
|
||||||
CAVEAT_TYPES,
|
CAVEAT_TYPES,
|
||||||
NOTIFICATION_NAMES,
|
NOTIFICATION_NAMES,
|
||||||
} from '../../../../../app/scripts/controllers/permissions/enums';
|
} from '../../app/scripts/controllers/permissions/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* README
|
* README
|
@ -1,6 +1,6 @@
|
|||||||
require('@babel/register');
|
require('@babel/register');
|
||||||
|
|
||||||
require('./helper');
|
require('./helpers/setup-helper');
|
||||||
|
|
||||||
window.SVGPathElement = window.SVGPathElement || { prototype: {} };
|
window.SVGPathElement = window.SVGPathElement || { prototype: {} };
|
||||||
global.indexedDB = {};
|
global.indexedDB = {};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
TRANSACTION_STATUSES,
|
TRANSACTION_STATUSES,
|
||||||
TRANSACTION_TYPES,
|
TRANSACTION_TYPES,
|
||||||
} from '../../../../../shared/constants/transaction';
|
} from '../../shared/constants/transaction';
|
||||||
|
|
||||||
export const txMetaStub = {
|
export const txMetaStub = {
|
||||||
firstRetryBlockNumber: '0x51a402',
|
firstRetryBlockNumber: '0x51a402',
|
@ -1,33 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import freeze from 'deep-freeze-strict';
|
|
||||||
import reducers from '../../../ui/app/ducks';
|
|
||||||
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
|
||||||
import { NETWORK_TYPE_RPC } from '../../../shared/constants/network';
|
|
||||||
|
|
||||||
describe('config view actions', function () {
|
|
||||||
const initialState = {
|
|
||||||
metamask: {
|
|
||||||
rpcUrl: 'foo',
|
|
||||||
frequentRpcList: [],
|
|
||||||
},
|
|
||||||
appState: {
|
|
||||||
currentView: {
|
|
||||||
name: 'accounts',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
freeze(initialState);
|
|
||||||
|
|
||||||
describe('SET_RPC_TARGET', function () {
|
|
||||||
it('sets the state.metamask.rpcUrl property of the state to the action.value', function () {
|
|
||||||
const action = {
|
|
||||||
type: actionConstants.SET_RPC_TARGET,
|
|
||||||
value: 'foo',
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = reducers(initialState, action);
|
|
||||||
assert.equal(result.metamask.provider.type, NETWORK_TYPE_RPC);
|
|
||||||
assert.equal(result.metamask.provider.rpcUrl, 'foo');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,34 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import freeze from 'deep-freeze-strict';
|
|
||||||
import reducers from '../../../ui/app/ducks';
|
|
||||||
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
|
||||||
|
|
||||||
describe('SET_ACCOUNT_LABEL', function () {
|
|
||||||
it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () {
|
|
||||||
const initialState = {
|
|
||||||
metamask: {
|
|
||||||
identities: {
|
|
||||||
foo: {
|
|
||||||
name: 'bar',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
freeze(initialState);
|
|
||||||
|
|
||||||
const action = {
|
|
||||||
type: actionConstants.SET_ACCOUNT_LABEL,
|
|
||||||
value: {
|
|
||||||
account: 'foo',
|
|
||||||
label: 'baz',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
freeze(action);
|
|
||||||
|
|
||||||
const resultingState = reducers(initialState, action);
|
|
||||||
assert.equal(
|
|
||||||
resultingState.metamask.identities.foo.name,
|
|
||||||
action.value.label,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,24 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import freeze from 'deep-freeze-strict';
|
|
||||||
import reducers from '../../../ui/app/ducks';
|
|
||||||
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
|
||||||
|
|
||||||
describe('SHOW_ACCOUNT_DETAIL', function () {
|
|
||||||
it('updates metamask state', function () {
|
|
||||||
const initialState = {
|
|
||||||
metamask: {
|
|
||||||
selectedAddress: 'foo',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
freeze(initialState);
|
|
||||||
|
|
||||||
const action = {
|
|
||||||
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
|
||||||
value: 'bar',
|
|
||||||
};
|
|
||||||
freeze(action);
|
|
||||||
|
|
||||||
const resultingState = reducers(initialState, action);
|
|
||||||
assert.equal(resultingState.metamask.selectedAddress, action.value);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,54 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import configureMockStore from 'redux-mock-store';
|
|
||||||
import thunk from 'redux-thunk';
|
|
||||||
import * as actions from '../../../ui/app/store/actions';
|
|
||||||
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
|
||||||
import { ROPSTEN_CHAIN_ID } from '../../../shared/constants/network';
|
|
||||||
|
|
||||||
const middlewares = [thunk];
|
|
||||||
const mockStore = configureMockStore(middlewares);
|
|
||||||
|
|
||||||
describe('tx confirmation screen', function () {
|
|
||||||
const txId = 1457634084250832;
|
|
||||||
const initialState = {
|
|
||||||
appState: {},
|
|
||||||
metamask: {
|
|
||||||
unapprovedTxs: {
|
|
||||||
[txId]: {
|
|
||||||
id: txId,
|
|
||||||
status: 'unconfirmed',
|
|
||||||
time: 1457634084250,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
provider: {
|
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const store = mockStore(initialState);
|
|
||||||
|
|
||||||
describe('cancelTx', function () {
|
|
||||||
it('creates COMPLETED_TX with the cancelled transaction ID', async function () {
|
|
||||||
actions._setBackgroundConnection({
|
|
||||||
approveTransaction(_, cb) {
|
|
||||||
cb(new Error('An error!'));
|
|
||||||
},
|
|
||||||
cancelTransaction(_, cb) {
|
|
||||||
cb();
|
|
||||||
},
|
|
||||||
getState(cb) {
|
|
||||||
cb(null, {});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
await store.dispatch(actions.cancelTx({ id: txId }));
|
|
||||||
const storeActions = store.getActions();
|
|
||||||
const completedTxAction = storeActions.find(
|
|
||||||
({ type }) => type === actionConstants.COMPLETED_TX,
|
|
||||||
);
|
|
||||||
const { id } = completedTxAction.value;
|
|
||||||
assert.equal(id, txId);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,24 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import freeze from 'deep-freeze-strict';
|
|
||||||
import * as actions from '../../../ui/app/store/actions';
|
|
||||||
import reducers from '../../../ui/app/ducks';
|
|
||||||
|
|
||||||
describe('action DISPLAY_WARNING', function () {
|
|
||||||
it('sets appState.warning to provided value', function () {
|
|
||||||
const initialState = {
|
|
||||||
appState: {},
|
|
||||||
};
|
|
||||||
freeze(initialState);
|
|
||||||
|
|
||||||
const warningText = 'This is a sample warning message';
|
|
||||||
|
|
||||||
const action = actions.displayWarning(warningText);
|
|
||||||
const resultingState = reducers(initialState, action);
|
|
||||||
|
|
||||||
assert.equal(
|
|
||||||
resultingState.appState.warning,
|
|
||||||
warningText,
|
|
||||||
'warning text set',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,23 +0,0 @@
|
|||||||
import { NETWORK_TYPE_RPC } from '../../shared/constants/network';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} FirstTimeState
|
|
||||||
* @property {Object} config Initial configuration parameters
|
|
||||||
* @property {Object} NetworkController Network controller state
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {FirstTimeState}
|
|
||||||
*/
|
|
||||||
const initialState = {
|
|
||||||
config: {},
|
|
||||||
NetworkController: {
|
|
||||||
provider: {
|
|
||||||
type: NETWORK_TYPE_RPC,
|
|
||||||
rpcUrl: 'http://localhost:8545',
|
|
||||||
chainId: '0x539',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default initialState;
|
|
@ -1,44 +0,0 @@
|
|||||||
import assert from 'assert';
|
|
||||||
import React from 'react';
|
|
||||||
import configureMockStore from 'redux-mock-store';
|
|
||||||
import { fireEvent } from '@testing-library/react';
|
|
||||||
import sinon from 'sinon';
|
|
||||||
import { renderWithProvider } from '../../../lib/render-helpers';
|
|
||||||
import { Dropdown } from '../../../../ui/app/components/app/dropdowns/components/dropdown';
|
|
||||||
|
|
||||||
describe('Dropdown components', function () {
|
|
||||||
const mockState = {
|
|
||||||
metamask: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
const props = {
|
|
||||||
isOpen: true,
|
|
||||||
zIndex: 11,
|
|
||||||
onClickOutside: sinon.spy(),
|
|
||||||
style: {
|
|
||||||
position: 'absolute',
|
|
||||||
right: 0,
|
|
||||||
top: '36px',
|
|
||||||
},
|
|
||||||
innerStyle: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
it('invokes click handler when item clicked', function () {
|
|
||||||
const store = configureMockStore()(mockState);
|
|
||||||
|
|
||||||
const onClickSpy = sinon.spy();
|
|
||||||
|
|
||||||
const { getByText } = renderWithProvider(
|
|
||||||
<Dropdown {...props}>
|
|
||||||
<li onClick={onClickSpy}>Item 1</li>
|
|
||||||
<li onClick={onClickSpy}>Item 2</li>
|
|
||||||
</Dropdown>,
|
|
||||||
store,
|
|
||||||
);
|
|
||||||
|
|
||||||
const item1 = getByText(/Item 1/u);
|
|
||||||
fireEvent.click(item1);
|
|
||||||
|
|
||||||
assert.ok(onClickSpy.calledOnce);
|
|
||||||
});
|
|
||||||
});
|
|
@ -2,9 +2,9 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import * as utils from '../../../../helpers/utils/util';
|
import * as utils from '../../../helpers/utils/util';
|
||||||
import Identicon from '../../../ui/identicon';
|
import Identicon from '../../ui/identicon';
|
||||||
import AccountListItem from '../account-list-item';
|
import AccountListItem from './account-list-item';
|
||||||
|
|
||||||
describe('AccountListItem Component', function () {
|
describe('AccountListItem Component', function () {
|
||||||
let wrapper, propsMethodSpies, checksumAddressStub;
|
let wrapper, propsMethodSpies, checksumAddressStub;
|
@ -3,8 +3,8 @@ import React from 'react';
|
|||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { mountWithRouter } from '../../../../../../test/lib/render-helpers';
|
import { mountWithRouter } from '../../../../../test/lib/render-helpers';
|
||||||
import AccountMenu from '..';
|
import AccountMenu from '.';
|
||||||
|
|
||||||
describe('Account Menu', function () {
|
describe('Account Menu', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -7,11 +7,11 @@ import thunk from 'redux-thunk';
|
|||||||
import { fireEvent } from '@testing-library/react';
|
import { fireEvent } from '@testing-library/react';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
|
|
||||||
import { renderWithProvider } from '../../../../../../../test/lib/render-helpers';
|
import { renderWithProvider } from '../../../../../../test/lib/render-helpers';
|
||||||
|
|
||||||
import * as actions from '../../../../../store/actions';
|
import * as actions from '../../../../store/actions';
|
||||||
import UnconnectedAccountAlert from '..';
|
import { KOVAN_CHAIN_ID } from '../../../../../../shared/constants/network';
|
||||||
import { KOVAN_CHAIN_ID } from '../../../../../../../shared/constants/network';
|
import UnconnectedAccountAlert from '.';
|
||||||
|
|
||||||
describe('Unconnected Account Alert', function () {
|
describe('Unconnected Account Alert', function () {
|
||||||
const selectedAddress = '0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b';
|
const selectedAddress = '0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b';
|
@ -2,9 +2,9 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import MetaFoxLogo from '../../../ui/metafox-logo';
|
import MetaFoxLogo from '../../ui/metafox-logo';
|
||||||
import AppHeader from '..';
|
import NetworkDisplay from '../network-display';
|
||||||
import NetworkDisplay from '../../network-display';
|
import AppHeader from './app-header.container';
|
||||||
|
|
||||||
describe('App Header', function () {
|
describe('App Header', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -2,7 +2,7 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import ConfirmDetailRow from '../confirm-detail-row.component';
|
import ConfirmDetailRow from './confirm-detail-row.component';
|
||||||
|
|
||||||
const propsMethodSpies = {
|
const propsMethodSpies = {
|
||||||
onHeaderClick: sinon.spy(),
|
onHeaderClick: sinon.spy(),
|
@ -3,11 +3,11 @@ import React from 'react';
|
|||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import ConfirmPageContainerHeader from '../confirm-page-container-header.component';
|
import configureStore from '../../../../store/store';
|
||||||
import configureStore from '../../../../../store/store';
|
import testData from '../../../../../../.storybook/test-data';
|
||||||
import testData from '../../../../../../../.storybook/test-data';
|
import ConfirmPageContainerHeader from './confirm-page-container-header.component';
|
||||||
|
|
||||||
const util = require('../../../../../../../app/scripts/lib/util');
|
const util = require('../../../../../../app/scripts/lib/util');
|
||||||
|
|
||||||
describe('Confirm Detail Row Component', function () {
|
describe('Confirm Detail Row Component', function () {
|
||||||
describe('render', function () {
|
describe('render', function () {
|
@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MenuDroppo from '../../menu-droppo';
|
import MenuDroppo from '../menu-droppo';
|
||||||
|
|
||||||
export class Dropdown extends Component {
|
export class Dropdown extends Component {
|
||||||
render() {
|
render() {
|
@ -2,7 +2,7 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import { DropdownMenuItem } from '../components/dropdown';
|
import { DropdownMenuItem } from './dropdown';
|
||||||
|
|
||||||
describe('Dropdown', function () {
|
describe('Dropdown', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -16,7 +16,7 @@ import { getEnvironmentType } from '../../../../../app/scripts/lib/util';
|
|||||||
|
|
||||||
import ColorIndicator from '../../ui/color-indicator';
|
import ColorIndicator from '../../ui/color-indicator';
|
||||||
import { COLORS, SIZES } from '../../../helpers/constants/design-system';
|
import { COLORS, SIZES } from '../../../helpers/constants/design-system';
|
||||||
import { Dropdown, DropdownMenuItem } from './components/dropdown';
|
import { Dropdown, DropdownMenuItem } from './dropdown';
|
||||||
|
|
||||||
// classes from nodes of the toggle element.
|
// classes from nodes of the toggle element.
|
||||||
const notToggleElementClassnames = [
|
const notToggleElementClassnames = [
|
||||||
|
@ -2,10 +2,10 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { mountWithRouter } from '../../../../../../test/lib/render-helpers';
|
import { mountWithRouter } from '../../../../../test/lib/render-helpers';
|
||||||
import NetworkDropdown from '../network-dropdown';
|
import ColorIndicator from '../../ui/color-indicator';
|
||||||
import { DropdownMenuItem } from '../components/dropdown';
|
import NetworkDropdown from './network-dropdown';
|
||||||
import ColorIndicator from '../../../ui/color-indicator';
|
import { DropdownMenuItem } from './dropdown';
|
||||||
|
|
||||||
describe('Network Dropdown', function () {
|
describe('Network Dropdown', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -2,7 +2,7 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import AdvancedTabContent from '..';
|
import AdvancedTabContent from './advanced-gas-inputs.container';
|
||||||
|
|
||||||
describe('Advanced Gas Inputs', function () {
|
describe('Advanced Gas Inputs', function () {
|
||||||
let wrapper, clock;
|
let wrapper, clock;
|
@ -1,8 +1,8 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import shallow from '../../../../../../../lib/shallow-with-context';
|
import shallow from '../../../../../../lib/shallow-with-context';
|
||||||
import AdvancedTabContent from '../advanced-tab-content.component';
|
import AdvancedTabContent from './advanced-tab-content.component';
|
||||||
|
|
||||||
describe('AdvancedTabContent Component', function () {
|
describe('AdvancedTabContent Component', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -1,10 +1,10 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import shallow from '../../../../../../../lib/shallow-with-context';
|
import shallow from '../../../../../../lib/shallow-with-context';
|
||||||
import BasicTabContent from '../basic-tab-content.component';
|
import GasPriceButtonGroup from '../../gas-price-button-group';
|
||||||
import GasPriceButtonGroup from '../../../gas-price-button-group';
|
import Loading from '../../../../ui/loading-screen';
|
||||||
import Loading from '../../../../../ui/loading-screen';
|
import { GAS_ESTIMATE_TYPES } from '../../../../../helpers/constants/common';
|
||||||
import { GAS_ESTIMATE_TYPES } from '../../../../../../helpers/constants/common';
|
import BasicTabContent from './basic-tab-content.component';
|
||||||
|
|
||||||
const mockGasPriceButtonGroupProps = {
|
const mockGasPriceButtonGroupProps = {
|
||||||
buttonDataLoading: false,
|
buttonDataLoading: false,
|
@ -1,12 +1,12 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import shallow from '../../../../../../lib/shallow-with-context';
|
import shallow from '../../../../../lib/shallow-with-context';
|
||||||
import GasModalPageContainer from '../gas-modal-page-container.component';
|
|
||||||
|
|
||||||
import PageContainer from '../../../../ui/page-container';
|
import PageContainer from '../../../ui/page-container';
|
||||||
|
|
||||||
import { Tab } from '../../../../ui/tabs';
|
import { Tab } from '../../../ui/tabs';
|
||||||
|
import GasModalPageContainer from './gas-modal-page-container.component';
|
||||||
|
|
||||||
const mockBasicGasEstimates = {
|
const mockBasicGasEstimates = {
|
||||||
average: '20',
|
average: '20',
|
@ -21,7 +21,7 @@ const sendActionSpies = {
|
|||||||
hideGasButtonGroup: sinon.spy(),
|
hideGasButtonGroup: sinon.spy(),
|
||||||
};
|
};
|
||||||
|
|
||||||
proxyquire('../gas-modal-page-container.container.js', {
|
proxyquire('./gas-modal-page-container.container.js', {
|
||||||
'react-redux': {
|
'react-redux': {
|
||||||
connect: (_, md, mp) => {
|
connect: (_, md, mp) => {
|
||||||
mapDispatchToProps = md;
|
mapDispatchToProps = md;
|
@ -1,11 +1,11 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import shallow from '../../../../../../lib/shallow-with-context';
|
import shallow from '../../../../../lib/shallow-with-context';
|
||||||
import GasPriceButtonGroup from '../gas-price-button-group.component';
|
import { GAS_ESTIMATE_TYPES } from '../../../../helpers/constants/common';
|
||||||
import { GAS_ESTIMATE_TYPES } from '../../../../../helpers/constants/common';
|
|
||||||
|
|
||||||
import ButtonGroup from '../../../../ui/button-group';
|
import ButtonGroup from '../../../ui/button-group';
|
||||||
|
import GasPriceButtonGroup from './gas-price-button-group.component';
|
||||||
|
|
||||||
describe('GasPriceButtonGroup Component', function () {
|
describe('GasPriceButtonGroup Component', function () {
|
||||||
let mockButtonPropsAndFlags;
|
let mockButtonPropsAndFlags;
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
import InfoBox from '..';
|
import InfoBox from './info-box.component';
|
||||||
|
|
||||||
describe('InfoBox', function () {
|
describe('InfoBox', function () {
|
||||||
let wrapper;
|
let wrapper;
|
@ -2,9 +2,9 @@ import assert from 'assert';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import configureStore from 'redux-mock-store';
|
import configureStore from 'redux-mock-store';
|
||||||
import { mountWithRouter } from '../../../../../../test/lib/render-helpers';
|
import { mountWithRouter } from '../../../../../test/lib/render-helpers';
|
||||||
import MenuBar from '..';
|
import { ROPSTEN_CHAIN_ID } from '../../../../../shared/constants/network';
|
||||||
import { ROPSTEN_CHAIN_ID } from '../../../../../../shared/constants/network';
|
import MenuBar from './menu-bar';
|
||||||
|
|
||||||
const initState = {
|
const initState = {
|
||||||
activeTab: {},
|
activeTab: {},
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user