Hard code chainId in tests

This commit is contained in:
Amir Bandeali 2019-08-13 16:52:03 -07:00
parent c5d4559300
commit 2da996f493
3 changed files with 7 additions and 14 deletions

View File

@ -1,17 +1,13 @@
import { addressUtils, blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { BigNumber, providerUtils, signTypedDataUtils } from '@0x/utils';
import { BigNumber, signTypedDataUtils } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts, TestLibEIP712ExchangeDomainContract } from '../src';
blockchainTests('LibEIP712ExchangeDomain', env => {
let chainId: number;
before(async () => {
chainId = await providerUtils.getChainIdAsync(env.provider);
});
describe('constructor', () => {
it('should calculate the correct domain hash when verifyingContractAddressIfExists is set to null', async () => {
const chainId = 1;
const libEIP712ExchangeDomainContract = await TestLibEIP712ExchangeDomainContract.deployFrom0xArtifactAsync(
artifacts.TestLibEIP712ExchangeDomain,
env.provider,
@ -30,6 +26,7 @@ blockchainTests('LibEIP712ExchangeDomain', env => {
expect(actualDomainHash).to.be.equal(expectedDomainHash);
});
it('should calculate the correct domain hash when verifyingContractAddressIfExists is set to a non-null address', async () => {
const chainId = 1;
const verifyingContractAddress = addressUtils.generatePseudoRandomAddress();
const libEIP712ExchangeDomainContract = await TestLibEIP712ExchangeDomainContract.deployFrom0xArtifactAsync(
artifacts.TestLibEIP712ExchangeDomain,

View File

@ -1,7 +1,7 @@
import { addressUtils, blockchainTests, constants, describe, expect } from '@0x/contracts-test-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { Order } from '@0x/types';
import { BigNumber, providerUtils, signTypedDataUtils } from '@0x/utils';
import { BigNumber, signTypedDataUtils } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts, TestLibOrderContract } from '../src';
@ -9,17 +9,15 @@ import { artifacts, TestLibOrderContract } from '../src';
blockchainTests('LibOrder', env => {
let libOrderContract: TestLibOrderContract;
let order: Order;
let chainId: number;
before(async () => {
libOrderContract = await TestLibOrderContract.deployFrom0xArtifactAsync(
artifacts.TestLibOrder,
env.provider,
env.txDefaults,
);
chainId = await providerUtils.getChainIdAsync(env.provider);
const domain = {
verifyingContractAddress: libOrderContract.address,
chainId,
chainId: 1,
};
order = {
...constants.STATIC_ORDER_PARAMS,

View File

@ -1,7 +1,7 @@
import { addressUtils, blockchainTests, constants, describe, expect } from '@0x/contracts-test-utils';
import { transactionHashUtils } from '@0x/order-utils';
import { ZeroExTransaction } from '@0x/types';
import { BigNumber, providerUtils, signTypedDataUtils } from '@0x/utils';
import { BigNumber, signTypedDataUtils } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts, TestLibZeroExTransactionContract } from '../src';
@ -9,17 +9,15 @@ import { artifacts, TestLibZeroExTransactionContract } from '../src';
blockchainTests('LibZeroExTransaction', env => {
let libZeroExTransactionContract: TestLibZeroExTransactionContract;
let zeroExTransaction: ZeroExTransaction;
let chainId: number;
before(async () => {
libZeroExTransactionContract = await TestLibZeroExTransactionContract.deployFrom0xArtifactAsync(
artifacts.TestLibZeroExTransaction,
env.provider,
env.txDefaults,
);
chainId = await providerUtils.getChainIdAsync(env.provider);
const domain = {
verifyingContractAddress: libZeroExTransactionContract.address,
chainId,
chainId: 1,
};
zeroExTransaction = {
signerAddress: addressUtils.generatePseudoRandomAddress(),