mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Move ganache server from test setup to individual test file. (#9703)
This commit is contained in:
parent
2d777c9178
commit
418662c365
@ -1,4 +1,3 @@
|
|||||||
import Ganache from 'ganache-core';
|
|
||||||
import nock from 'nock';
|
import nock from 'nock';
|
||||||
import Enzyme from 'enzyme';
|
import Enzyme from 'enzyme';
|
||||||
import Adapter from 'enzyme-adapter-react-16';
|
import Adapter from 'enzyme-adapter-react-16';
|
||||||
@ -31,13 +30,6 @@ process.on('exit', () => {
|
|||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
|
||||||
// ganache server
|
|
||||||
const server = Ganache.server();
|
|
||||||
server.listen(8545);
|
|
||||||
|
|
||||||
server.on('error', console.error);
|
|
||||||
server.on('clientError', console.error);
|
|
||||||
|
|
||||||
log.setDefaultLevel(5);
|
log.setDefaultLevel(5);
|
||||||
global.log = log;
|
global.log = log;
|
||||||
|
|
||||||
|
@ -11,6 +11,10 @@ import createTxMeta from '../../../lib/createTxMeta';
|
|||||||
import { addHexPrefix } from '../../../../app/scripts/lib/util';
|
import { addHexPrefix } from '../../../../app/scripts/lib/util';
|
||||||
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
|
||||||
|
|
||||||
|
const Ganache = require('../../../e2e/ganache');
|
||||||
|
|
||||||
|
const ganacheServer = new Ganache();
|
||||||
|
|
||||||
const threeBoxSpies = {
|
const threeBoxSpies = {
|
||||||
init: sinon.stub(),
|
init: sinon.stub(),
|
||||||
getThreeBoxSyncingState: sinon.stub().returns(true),
|
getThreeBoxSyncingState: sinon.stub().returns(true),
|
||||||
@ -90,6 +94,10 @@ describe('MetaMaskController', function () {
|
|||||||
const sandbox = sinon.createSandbox();
|
const sandbox = sinon.createSandbox();
|
||||||
const noop = () => undefined;
|
const noop = () => undefined;
|
||||||
|
|
||||||
|
before(async function () {
|
||||||
|
await ganacheServer.start();
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
nock('https://min-api.cryptocompare.com')
|
nock('https://min-api.cryptocompare.com')
|
||||||
.persist()
|
.persist()
|
||||||
@ -133,6 +141,10 @@ describe('MetaMaskController', function () {
|
|||||||
sandbox.restore();
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after(async function () {
|
||||||
|
await ganacheServer.quit();
|
||||||
|
});
|
||||||
|
|
||||||
describe('#getAccounts', function () {
|
describe('#getAccounts', function () {
|
||||||
it('returns first address when dapp calls web3.eth.getAccounts', async function () {
|
it('returns first address when dapp calls web3.eth.getAccounts', async function () {
|
||||||
const password = 'a-fake-password';
|
const password = 'a-fake-password';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user