aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-28 06:32:33 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-28 06:32:33 +0800
commitf862a2af6d9802c2c75f813025517e0c52cd513c (patch)
tree8c7a2f97e8400e7a3f4ef96e198b902c3d868a0a /packages
parent32867c9a07fc7c833ff8491ec4feea8c783e7f4d (diff)
downloaddexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar.gz
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar.bz2
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar.lz
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar.xz
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.tar.zst
dexon-sol-tools-f862a2af6d9802c2c75f813025517e0c52cd513c.zip
Fix tests
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/test/subscription_test.ts31
1 files changed, 18 insertions, 13 deletions
diff --git a/packages/0x.js/test/subscription_test.ts b/packages/0x.js/test/subscription_test.ts
index 7a818af37..e3b15808b 100644
--- a/packages/0x.js/test/subscription_test.ts
+++ b/packages/0x.js/test/subscription_test.ts
@@ -19,6 +19,7 @@ import {BlockParamLiteral, DoneCallback} from '../src/types';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
import {chaiSetup} from './utils/chai_setup';
import {constants} from './utils/constants';
+import {reportCallbackErrors} from './utils/report_callback_errors';
import {TokenUtils} from './utils/token_utils';
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) => {
(async () => {
const errMsg = 'Error fetching block';
- const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
- expect(err).to.be.equal(errMsg);
- expect(logEvent).to.be.undefined();
- done();
- };
+ const callback = reportCallbackErrors(done)(
+ (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ expect(err.message).to.be.equal(errMsg);
+ expect(logEvent).to.be.undefined();
+ done();
+ },
+ );
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
- .throws(errMsg),
+ .throws(new Error(errMsg)),
];
zeroEx.token.subscribe(
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) => {
(async () => {
const errMsg = 'Error fetching logs';
- const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
- expect(err).to.be.equal(errMsg);
- expect(logEvent).to.be.undefined();
- done();
- };
+ const callback = reportCallbackErrors(done)(
+ (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ expect(err.message).to.be.equal(errMsg);
+ expect(logEvent).to.be.undefined();
+ done();
+ },
+ );
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'getLogsAsync')
- .throws(errMsg),
+ .throws(new Error(errMsg)),
];
zeroEx.token.subscribe(
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
@@ -109,7 +114,7 @@ describe('SubscriptionTest', () => {
tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
- .throws('JSON RPC error'),
+ .throws(new Error('JSON RPC error')),
];
zeroEx.token.unsubscribeAll();
done();