Fix lint and ts issues

This commit is contained in:
Fabio Berger 2017-11-13 12:30:01 -05:00
parent 70661c179f
commit 2060940ecc
2 changed files with 10 additions and 10 deletions

View File

@ -807,7 +807,7 @@ export class ExchangeWrapper extends ContractWrapper {
if (!_.isUndefined(errLog)) { if (!_.isUndefined(errLog)) {
const logArgs = errLog.args; const logArgs = errLog.args;
const errCode = logArgs.errorId.toNumber(); const errCode = logArgs.errorId.toNumber();
const errMessage = this._exchangeContractErrCodesToMsg[errCode]; const errMessage: ExchangeContractErrs = this._exchangeContractErrCodesToMsg[errCode];
throw new Error(errMessage); throw new Error(errMessage);
} }
} }

View File

@ -13,7 +13,7 @@ import {
Token, Token,
ApprovalContractEventArgs, ApprovalContractEventArgs,
TokenEvents, TokenEvents,
LogEvent, DecodedLogEvent,
} from '../src'; } from '../src';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
import {TokenUtils} from './utils/token_utils'; import {TokenUtils} from './utils/token_utils';
@ -64,15 +64,15 @@ describe('SubscriptionTest', () => {
}); });
it('Should receive the Error when an error occurs', (done: DoneCallback) => { it('Should receive the Error when an error occurs', (done: DoneCallback) => {
(async () => { (async () => {
const callback = (err: Error, logEvent: LogEvent<ApprovalContractEventArgs>) => { const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
expect(err).to.not.be.null(); expect(err).to.not.be.null();
expect(logEvent).to.be.undefined(); expect(logEvent).to.be.undefined();
done(); done();
}; };
stubs = [ stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync') Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync')
.throws("JSON RPC error") .throws('JSON RPC error'),
] ];
zeroEx.token.subscribe( zeroEx.token.subscribe(
tokenAddress, TokenEvents.Approval, indexFilterValues, callback); tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount); await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount);
@ -80,16 +80,16 @@ describe('SubscriptionTest', () => {
}); });
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => { it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => { (async () => {
const callback = (err: Error, logEvent: LogEvent<ApprovalContractEventArgs>) => { }; const callback = (err: Error, logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop;
zeroEx.token.subscribe( zeroEx.token.subscribe(
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('JSON RPC error'),
] ];
zeroEx.token.unsubscribeAll(); zeroEx.token.unsubscribeAll();
done(); done();
})().catch(done); })().catch(done);
}); });
}) });
}) });