Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Add tests for adding/removing an exchange called by owner
Browse files Browse the repository at this point in the history
  • Loading branch information
abandeali1 committed Oct 1, 2019
1 parent 745da8e commit aa198ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contracts/staking/test/unit_tests/exchange_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ blockchainTests.resets('Exchange Unit Tests', env => {
return expect(tx).to.revertWith(expectedError);
});

it('should revert when adding an exchange if called by the (non-authorized) owner', async () => {
const expectedError = new AuthorizableRevertErrors.SenderNotAuthorizedError(owner);
const tx = exchangeManager.addExchangeAddress.awaitTransactionSuccessAsync(nonExchange, {
from: owner,
});
return expect(tx).to.revertWith(expectedError);
});

it('should successfully add an exchange if called by an authorized address', async () => {
// Register a new exchange.
const receipt = await exchangeManager.addExchangeAddress.awaitTransactionSuccessAsync(nonExchange, {
Expand Down Expand Up @@ -128,6 +136,14 @@ blockchainTests.resets('Exchange Unit Tests', env => {
return expect(tx).to.revertWith(expectedError);
});

it('should revert when removing an exchange if called by the (non-authorized) owner', async () => {
const expectedError = new AuthorizableRevertErrors.SenderNotAuthorizedError(owner);
const tx = exchangeManager.removeExchangeAddress.awaitTransactionSuccessAsync(nonExchange, {
from: owner,
});
return expect(tx).to.revertWith(expectedError);
});

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, {
Expand Down

0 comments on commit aa198ad

Please sign in to comment.