Fix tests
This commit is contained in:
parent
32867c9a07
commit
f862a2af6d
@ -19,6 +19,7 @@ import {BlockParamLiteral, DoneCallback} from '../src/types';
|
|||||||
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
|
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
|
||||||
import {chaiSetup} from './utils/chai_setup';
|
import {chaiSetup} from './utils/chai_setup';
|
||||||
import {constants} from './utils/constants';
|
import {constants} from './utils/constants';
|
||||||
|
import {reportCallbackErrors} from './utils/report_callback_errors';
|
||||||
import {TokenUtils} from './utils/token_utils';
|
import {TokenUtils} from './utils/token_utils';
|
||||||
import {web3Factory} from './utils/web3_factory';
|
import {web3Factory} from './utils/web3_factory';
|
||||||
|
|
||||||
@ -71,14 +72,16 @@ describe('SubscriptionTest', () => {
|
|||||||
it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => {
|
it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const errMsg = 'Error fetching block';
|
const errMsg = 'Error fetching block';
|
||||||
const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
|
const callback = reportCallbackErrors(done)(
|
||||||
expect(err).to.be.equal(errMsg);
|
(err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
|
||||||
expect(logEvent).to.be.undefined();
|
expect(err.message).to.be.equal(errMsg);
|
||||||
done();
|
expect(logEvent).to.be.undefined();
|
||||||
};
|
done();
|
||||||
|
},
|
||||||
|
);
|
||||||
stubs = [
|
stubs = [
|
||||||
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
|
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
|
||||||
.throws(errMsg),
|
.throws(new Error(errMsg)),
|
||||||
];
|
];
|
||||||
zeroEx.token.subscribe(
|
zeroEx.token.subscribe(
|
||||||
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
||||||
@ -88,14 +91,16 @@ describe('SubscriptionTest', () => {
|
|||||||
it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => {
|
it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const errMsg = 'Error fetching logs';
|
const errMsg = 'Error fetching logs';
|
||||||
const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
|
const callback = reportCallbackErrors(done)(
|
||||||
expect(err).to.be.equal(errMsg);
|
(err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
|
||||||
expect(logEvent).to.be.undefined();
|
expect(err.message).to.be.equal(errMsg);
|
||||||
done();
|
expect(logEvent).to.be.undefined();
|
||||||
};
|
done();
|
||||||
|
},
|
||||||
|
);
|
||||||
stubs = [
|
stubs = [
|
||||||
Sinon.stub((zeroEx as any)._web3Wrapper, 'getLogsAsync')
|
Sinon.stub((zeroEx as any)._web3Wrapper, 'getLogsAsync')
|
||||||
.throws(errMsg),
|
.throws(new Error(errMsg)),
|
||||||
];
|
];
|
||||||
zeroEx.token.subscribe(
|
zeroEx.token.subscribe(
|
||||||
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
||||||
@ -109,7 +114,7 @@ describe('SubscriptionTest', () => {
|
|||||||
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
|
||||||
stubs = [
|
stubs = [
|
||||||
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
|
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
|
||||||
.throws('JSON RPC error'),
|
.throws(new Error('JSON RPC error')),
|
||||||
];
|
];
|
||||||
zeroEx.token.unsubscribeAll();
|
zeroEx.token.unsubscribeAll();
|
||||||
done();
|
done();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user