Add tests for adding/removing an exchange called by owner

This commit is contained in:
Amir Bandeali 2019-09-30 17:42:25 -07:00
parent 745da8e363
commit aa198ad15f

View File

@ -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, {
@ -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, {