Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Await in tests to prevent clash in before blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dekz committed Mar 21, 2019
1 parent 8453c5e commit bec440c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/contract-wrappers/test/exchange_wrapper_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);

describe('ExchangeWrapper', () => {
describe.only('ExchangeWrapper', () => {
let contractWrappers: ContractWrappers;
let userAddresses: string[];
let zrxTokenAddress: string;
Expand Down Expand Up @@ -329,16 +329,26 @@ describe('ExchangeWrapper', () => {
new BigNumber(2).pow(20).minus(1),
);
const untransferrableMakerAssetData = assetDataUtils.encodeERC20AssetData(untransferrableToken.address);
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
const invalidSignedOrder = await fillScenarios.createFillableSignedOrderAsync(
untransferrableMakerAssetData,
takerAssetData,
makerAddress,
takerAddress,
fillableAmount,
);
expect(
contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrder),
).to.eventually.to.be.rejectedWith(RevertReason.TransferFailed);
await web3Wrapper.awaitTransactionSuccessAsync(
await contractWrappers.erc20Token.setProxyAllowanceAsync(
untransferrableToken.address,
makerAddress,
signedOrder.makerAssetAmount,
),
);
try {
await contractWrappers.exchange.validateOrderFillableOrThrowAsync(invalidSignedOrder);
expect(true).to.be.false(); // never hit
} catch (e) {
expect(e.message).to.include('TRANSFER_FAILED');
}
});
});
describe('#isValidSignature', () => {
Expand Down

0 comments on commit bec440c

Please sign in to comment.