This commit is contained in:
Greg Hysen
2019-02-27 11:49:43 -08:00
parent 68ed56f2d9
commit 28209e9413
2 changed files with 335 additions and 277 deletions

View File

@@ -3,6 +3,7 @@ import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import * as chai from 'chai';
import { BigNumber } from '@0x/utils';
@@ -17,6 +18,8 @@ import {
DummyERC1155ReceiverBatchTokenReceivedEventArgs,
} from '../../src';
const expect = chai.expect;
export class Erc1155Wrapper {
private readonly _erc1155Contract: DummyERC1155TokenContract;
private readonly _web3Wrapper: Web3Wrapper;
@@ -96,4 +99,20 @@ export class Erc1155Wrapper {
const nftId = token.plus(1);
return [token, nftId];
}
public async assertBalancesAsync(owners: string[], tokens: BigNumber[], expectedBalances: BigNumber[]): Promise<void> {
const ownersExtended: string[] = [];
const tokensExtended: BigNumber[] = [];
_.each(tokens, (token: BigNumber) => {
ownersExtended.concat(owners);
_.range(0, owners.length, () => {tokensExtended.push(token)});
});
const balances = await this.getBalancesAsync(
ownersExtended,
tokensExtended,
);
_.each(balances, (balance: BigNumber, i: number) => {
expect(balance, `${ownersExtended[i]}${tokensExtended[i]}`).to.be.bignumber.equal(expectedBalances[i]);
});
}
}