Add blockchainLifecycle management to the ExpirationWatcher test
This commit is contained in:
parent
b38142ddb1
commit
c0e17f6136
@ -12,11 +12,13 @@ import {TokenUtils} from './utils/token_utils';
|
|||||||
import {ExpirationWatcher} from '../src/order_watcher/expiration_watcher';
|
import {ExpirationWatcher} from '../src/order_watcher/expiration_watcher';
|
||||||
import {Token, DoneCallback} from '../src/types';
|
import {Token, DoneCallback} from '../src/types';
|
||||||
import {ZeroEx} from '../src/0x';
|
import {ZeroEx} from '../src/0x';
|
||||||
|
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
|
||||||
import {FillScenarios} from './utils/fill_scenarios';
|
import {FillScenarios} from './utils/fill_scenarios';
|
||||||
import {reportCallbackErrors} from './utils/report_callback_errors';
|
import {reportCallbackErrors} from './utils/report_callback_errors';
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
const blockchainLifecycle = new BlockchainLifecycle();
|
||||||
|
|
||||||
describe('ExpirationWatcher', () => {
|
describe('ExpirationWatcher', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
@ -52,14 +54,16 @@ describe('ExpirationWatcher', () => {
|
|||||||
makerTokenAddress = makerToken.address;
|
makerTokenAddress = makerToken.address;
|
||||||
takerTokenAddress = takerToken.address;
|
takerTokenAddress = takerToken.address;
|
||||||
});
|
});
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
|
await blockchainLifecycle.startAsync();
|
||||||
const sinonTimerConfig = {shouldAdvanceTime: true} as any;
|
const sinonTimerConfig = {shouldAdvanceTime: true} as any;
|
||||||
// This constructor has incorrect types
|
// This constructor has incorrect types
|
||||||
timer = Sinon.useFakeTimers(sinonTimerConfig);
|
timer = Sinon.useFakeTimers(sinonTimerConfig);
|
||||||
currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
|
currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
|
||||||
expirationWatcher = new ExpirationWatcher();
|
expirationWatcher = new ExpirationWatcher();
|
||||||
});
|
});
|
||||||
afterEach(() => {
|
afterEach(async () => {
|
||||||
|
await blockchainLifecycle.revertAsync();
|
||||||
timer.restore();
|
timer.restore();
|
||||||
expirationWatcher.unsubscribe();
|
expirationWatcher.unsubscribe();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user