diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-16 20:59:10 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-16 20:59:10 +0800 |
commit | 839db68571037f6fff8273aaade6ea0bd14ea8a5 (patch) | |
tree | 302b3164f01bc5363bf07841a42fa30b3842169e /packages/contract-wrappers/test | |
parent | fec6ac3ff0c4781cea0b3f42e287aee2b8aa2a79 (diff) | |
download | dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar.gz dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar.bz2 dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar.lz dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar.xz dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.tar.zst dexon-sol-tools-839db68571037f6fff8273aaade6ea0bd14ea8a5.zip |
Fix TSLint rules
Diffstat (limited to 'packages/contract-wrappers/test')
-rw-r--r-- | packages/contract-wrappers/test/ether_token_wrapper_test.ts | 4 | ||||
-rw-r--r-- | packages/contract-wrappers/test/global_hooks.ts | 3 | ||||
-rw-r--r-- | packages/contract-wrappers/test/order_validation_test.ts | 17 |
3 files changed, 16 insertions, 8 deletions
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index e9a9705b1..74f84a485 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -41,7 +41,7 @@ describe('EtherTokenWrapper', () => { let addressWithETH: string; let wethContractAddress: string; let depositWeiAmount: BigNumber; - let decimalPlaces: number; + const decimalPlaces = 7; let addressWithoutFunds: string; const gasPrice = new BigNumber(1); const zeroExConfig = { @@ -59,7 +59,6 @@ describe('EtherTokenWrapper', () => { addressWithETH = userAddresses[0]; wethContractAddress = contractWrappers.etherToken.getContractAddressIfExists() as string; depositWeiAmount = Web3Wrapper.toWei(new BigNumber(5)); - decimalPlaces = 7; addressWithoutFunds = userAddresses[1]; }); beforeEach(async () => { @@ -154,6 +153,7 @@ describe('EtherTokenWrapper', () => { const preWETHBalance = await contractWrappers.token.getBalanceAsync(wethContractAddress, addressWithETH); expect(preWETHBalance).to.be.bignumber.equal(0); + // tslint:disable-next-line:custom-no-magic-numbers const overWETHBalance = preWETHBalance.add(999999999); return expect( diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts index 53b3ef545..fa1dfae38 100644 --- a/packages/contract-wrappers/test/global_hooks.ts +++ b/packages/contract-wrappers/test/global_hooks.ts @@ -8,7 +8,8 @@ import { provider } from './utils/web3_wrapper'; before('migrate contracts', async function(): Promise<void> { // HACK: Since the migrations take longer then our global mocha timeout limit // we manually increase it for this before hook. - this.timeout(20000); + const mochaTestTimeoutMs = 20000; + this.timeout(mochaTestTimeoutMs); const txDefaults = { gas: devConstants.GAS_ESTIMATE, from: devConstants.TESTRPC_FIRST_ADDRESS, diff --git a/packages/contract-wrappers/test/order_validation_test.ts b/packages/contract-wrappers/test/order_validation_test.ts index d28549ba2..ed2159026 100644 --- a/packages/contract-wrappers/test/order_validation_test.ts +++ b/packages/contract-wrappers/test/order_validation_test.ts @@ -105,6 +105,7 @@ describe('OrderValidation', () => { }); it('should succeed if the order is asymmetric and fillable', async () => { const makerFillableAmount = fillableAmount; + // tslint:disable-next-line:custom-no-magic-numbers const takerFillableAmount = fillableAmount.minus(4); const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync( makerTokenAddress, @@ -171,6 +172,7 @@ describe('OrderValidation', () => { fillableAmount, ); // 27 <--> 28 + // tslint:disable-next-line:custom-no-magic-numbers signedOrder.ecSignature.v = 28 - signedOrder.ecSignature.v + 27; return expect( contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( @@ -205,7 +207,8 @@ describe('OrderValidation', () => { takerAddress, fillableAmount, ); - const nonTakerAddress = userAddresses[6]; + const sixthIndex = 6; + const nonTakerAddress = userAddresses[sixthIndex]; return expect( contractWrappers.exchange.validateFillOrderThrowIfInvalidAsync( signedOrder, @@ -352,7 +355,8 @@ describe('OrderValidation', () => { takerAddress, zrxTokenAddress, ); - expect(transferFromAsync.callCount).to.be.equal(4); + const expectedCallCount = 4; + expect(transferFromAsync.callCount).to.be.equal(expectedCallCount); expect( transferFromAsync .getCall(0) @@ -422,7 +426,8 @@ describe('OrderValidation', () => { takerAddress, zrxTokenAddress, ); - expect(transferFromAsync.callCount).to.be.equal(4); + const expectedCallCount = 4; + expect(transferFromAsync.callCount).to.be.equal(expectedCallCount); expect( transferFromAsync .getCall(0) @@ -490,7 +495,8 @@ describe('OrderValidation', () => { takerAddress, zrxTokenAddress, ); - expect(transferFromAsync.callCount).to.be.equal(4); + const expectedCallCount = 4; + expect(transferFromAsync.callCount).to.be.equal(expectedCallCount); const makerFillAmount = transferFromAsync.getCall(0).args[3]; expect(makerFillAmount).to.be.bignumber.equal(makerTokenAmount); }); @@ -517,7 +523,8 @@ describe('OrderValidation', () => { ); const makerPartialFee = makerFee.div(2); const takerPartialFee = takerFee.div(2); - expect(transferFromAsync.callCount).to.be.equal(4); + const expectedCallCount = 4; + expect(transferFromAsync.callCount).to.be.equal(expectedCallCount); const partialMakerFee = transferFromAsync.getCall(2).args[3]; expect(partialMakerFee).to.be.bignumber.equal(makerPartialFee); const partialTakerFee = transferFromAsync.getCall(3).args[3]; |