Ran prettier & linter

This commit is contained in:
Greg Hysen
2019-03-05 10:58:26 -08:00
parent 38e4871f32
commit 05ef250ab4
4 changed files with 36 additions and 48 deletions

View File

@@ -3,13 +3,11 @@ import {
constants,
expectTransactionFailedAsync,
expectTransactionFailedWithoutReasonAsync,
LogDecoder,
provider,
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
@@ -24,20 +22,14 @@ import {
ERC1155MintableContract,
ERC1155ProxyWrapper,
ERC721ProxyContract,
IAssetProxyContract,
} from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetProxyInterface = new IAssetProxyContract(
artifacts.IAssetProxy.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
// tslint:disable:no-unnecessary-type-assertion
describe.only('ERC1155Proxy', () => {
describe('ERC1155Proxy', () => {
// constant values used in transfer tests
const nftOwnerBalance = new BigNumber(1);
const nftNotOwnerBalance = new BigNumber(0);
@@ -156,7 +148,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
const totalValueTransferred = valuesToTransfer[0].times(perUnitValue);
@@ -194,7 +186,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
let totalValueTransferred = _.reduce(valuesToTransfer, (sum: BigNumber, value: BigNumber) => {
@@ -240,7 +232,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
const totalValuesTransferred = _.map(valuesToTransfer, (value: BigNumber) => {
@@ -281,7 +273,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
const expectedFinalBalances = [
@@ -323,7 +315,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
const expectedFinalBalances = [
@@ -377,7 +369,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check balances after transfer
const totalValuesTransferred = _.map(valuesToTransfer, (value: BigNumber) => {
@@ -420,7 +412,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
);
// check receiver log ignored extra asset data
expect(txReceipt.logs.length).to.be.equal(2);
@@ -465,7 +457,7 @@ describe.only('ERC1155Proxy', () => {
perUnitValue,
receiverCallbackData,
authorized,
extraData
extraData,
);
// check receiver log ignored extra asset data
expect(txReceipt.logs.length).to.be.equal(2);
@@ -512,7 +504,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.TransferRejected,
);
@@ -544,7 +536,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.nftNotOwnedByFromAddress,
);
@@ -577,7 +569,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.transferGreaterThanZeroRequired,
);
@@ -612,7 +604,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.Uint256Overflow,
);
@@ -641,7 +633,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.amountEqualToOneRequired,
);
@@ -670,7 +662,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.amountEqualToOneRequired,
);
@@ -695,7 +687,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.Uint256Underflow,
);
@@ -725,7 +717,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
authorized
authorized,
),
RevertReason.InsufficientAllowance,
);
@@ -749,7 +741,7 @@ describe.only('ERC1155Proxy', () => {
valuesToTransfer,
perUnitValue,
receiverCallbackData,
notAuthorized
notAuthorized,
),
RevertReason.SenderNotAuthorized,
);

View File

@@ -13,12 +13,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import {
artifacts,
ERC1155MintableContract,
ERC1155ProxyContract,
IAssetProxyContract,
} from '../../src';
import { artifacts, ERC1155MintableContract, ERC1155ProxyContract, IAssetProxyContract } from '../../src';
export class ERC1155ProxyWrapper {
private readonly _tokenOwnerAddresses: string[];
@@ -34,13 +29,13 @@ export class ERC1155ProxyWrapper {
private _proxyContract?: ERC1155ProxyContract;
private _proxyIdIfExists?: string;
private _initialTokenIdsByOwner: ERC1155HoldingsByOwner = { fungible: {}, nonFungible: {} };
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
this._dummyTokenWrappers = [];
this._assetProxyInterface = new IAssetProxyContract(
this._assetProxyInterface = new IAssetProxyContract(
artifacts.IAssetProxy.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
@@ -132,8 +127,8 @@ export class ERC1155ProxyWrapper {
valueMultiplier,
receiverCallbackData,
authorizedSender,
extraData
)
extraData,
),
);
return txReceipt;
}
@@ -178,7 +173,7 @@ export class ERC1155ProxyWrapper {
}
// Non-fungible tokens
// tslint:disable-next-line:no-unused-variable
for (const i of _.times(constants.NUM_ERC1155_NONFUNGIBLE_TOKENS_MINT)) {
for (const j of _.times(constants.NUM_ERC1155_NONFUNGIBLE_TOKENS_MINT)) {
const [tokenId, nftIds] = await dummyWrapper.mintNonFungibleTokensAsync(this._tokenOwnerAddresses);
const tokenIdAsString = tokenId.toString();
this._nonFungibleTokenIds.push(tokenIdAsString);