Fix tests

This commit is contained in:
Amir Bandeali
2019-09-29 17:36:55 -07:00
parent be173a9970
commit 745da8e363
5 changed files with 12 additions and 29 deletions

View File

@@ -28,6 +28,7 @@ blockchainTests('Migration tests', env => {
env.txDefaults,
artifacts,
);
await stakingContract.addAuthorizedAddress.awaitTransactionSuccessAsync(authorizedAddress);
});
describe('StakingProxy', () => {
@@ -37,13 +38,15 @@ blockchainTests('Migration tests', env => {
let revertAddress: string;
async function deployStakingProxyAsync(stakingContractAddress?: string): Promise<TestStakingProxyContract> {
return TestStakingProxyContract.deployFrom0xArtifactAsync(
const proxyContract = await TestStakingProxyContract.deployFrom0xArtifactAsync(
artifacts.TestStakingProxy,
env.provider,
env.txDefaults,
artifacts,
stakingContractAddress || constants.NULL_ADDRESS,
);
await proxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync(authorizedAddress);
return proxyContract;
}
before(async () => {

View File

@@ -95,20 +95,6 @@ blockchainTests.resets('Exchange Unit Tests', env => {
return expect(tx).to.revertWith(expectedError);
});
it('should successfully add an exchange if called by the (authorized) owner', async () => {
// Register a new exchange.
const receipt = await exchangeManager.addExchangeAddress.awaitTransactionSuccessAsync(nonExchange, {
from: owner,
});
// Ensure that the logged event was correct.
verifyExchangeManagerEvent(ExchangeManagerEventType.ExchangeAdded, nonExchange, receipt);
// Ensure that the exchange was successfully registered.
const isValidExchange = await exchangeManager.validExchanges.callAsync(nonExchange);
expect(isValidExchange).to.be.true();
});
it('should successfully add an exchange if called by an authorized address', async () => {
// Register a new exchange.
const receipt = await exchangeManager.addExchangeAddress.awaitTransactionSuccessAsync(nonExchange, {
@@ -142,20 +128,6 @@ blockchainTests.resets('Exchange Unit Tests', env => {
return expect(tx).to.revertWith(expectedError);
});
it('should successfully remove an exchange if called by the (authorized) owner', async () => {
// Remove the registered exchange.
const receipt = await exchangeManager.removeExchangeAddress.awaitTransactionSuccessAsync(exchange, {
from: owner,
});
// Ensure that the logged event was correct.
verifyExchangeManagerEvent(ExchangeManagerEventType.ExchangeRemoved, exchange, receipt);
// Ensure that the exchange was removed.
const isValidExchange = await exchangeManager.validExchanges.callAsync(exchange);
expect(isValidExchange).to.be.false();
});
it('should successfully remove a registered exchange if called by an authorized address', async () => {
// Remove the registered exchange.
const receipt = await exchangeManager.removeExchangeAddress.awaitTransactionSuccessAsync(exchange, {

View File

@@ -21,6 +21,7 @@ blockchainTests('Configurable Parameters unit tests', env => {
env.txDefaults,
artifacts,
);
await testContract.addAuthorizedAddress.awaitTransactionSuccessAsync(authorizedAddress);
});
blockchainTests.resets('setParams()', () => {

View File

@@ -57,6 +57,8 @@ blockchainTests.resets('ZrxVault unit tests', env => {
zrxTokenContract.address,
);
await zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(owner);
// configure erc20 proxy to accept calls from zrx vault
await erc20ProxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync(zrxVault.address);
});

View File

@@ -236,6 +236,8 @@ export async function deployAndConfigureContractsAsync(
zrxTokenContract.address,
);
await zrxVaultContract.addAuthorizedAddress.awaitTransactionSuccessAsync(ownerAddress);
// deploy staking contract
const stakingContract = await TestStakingContract.deployFrom0xArtifactAsync(
customStakingArtifact !== undefined ? customStakingArtifact : artifacts.TestStaking,
@@ -263,6 +265,9 @@ export async function deployAndConfigureContractsAsync(
stakingContract.address,
readOnlyProxyContract.address,
);
await stakingProxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync(ownerAddress);
// deploy cobb douglas contract
const cobbDouglasContract = await TestCobbDouglasContract.deployFrom0xArtifactAsync(
artifacts.TestCobbDouglas,