ERC1155 Wrapper without chai

This commit is contained in:
Jacob Evans 2019-11-26 16:09:40 +11:00
parent d431790e19
commit 935dca67e6
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
3 changed files with 5 additions and 6 deletions

View File

@ -16,7 +16,7 @@ export {
export { ERC20Wrapper } from './erc20_wrapper';
export { ERC721Wrapper } from './erc721_wrapper';
export { ERC1155ProxyWrapper } from './erc1155_proxy_wrapper';
export { Erc1155Wrapper, ERC1155MintableContract } from '@0x/contracts-erc1155';
export { ERC1155MintableContract, Erc1155Wrapper } from '@0x/contracts-erc1155';
export { DummyERC20TokenContract } from '@0x/contracts-erc20';
export { DummyERC721TokenContract } from '@0x/contracts-erc721';
export {

View File

@ -64,7 +64,6 @@
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@0x/typescript-typings": "^4.4.0-beta.2",
"@0x/contracts-test-utils": "^3.2.0-beta.3",
"ethereum-types": "^2.2.0-beta.2",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
@ -82,6 +81,7 @@
},
"dependencies": {
"@0x/base-contract": "^5.5.0-beta.3",
"@0x/contracts-test-utils": "^3.2.0-beta.3",
"@0x/utils": "^4.6.0-beta.2",
"@0x/web3-wrapper": "^6.1.0-beta.2",
"lodash": "^4.17.11"

View File

@ -1,12 +1,9 @@
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { ERC1155MintableContract, ERC1155TransferSingleEventArgs } from './wrappers';
const expect = chai.expect;
export class Erc1155Wrapper {
private readonly _erc1155Contract: ERC1155MintableContract;
private readonly _contractOwner: string;
@ -135,7 +132,9 @@ export class Erc1155Wrapper {
});
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]);
if (!balance.isEqualTo(expectedBalances[i])) {
throw new Error(`${ownersExtended[i]}${tokensExtended[i]} balance not equal ${expectedBalances[i]}`);
}
});
}
public async isNonFungibleItemAsync(tokenId: BigNumber): Promise<boolean> {