From aa198ad15f7b012c3be04ddf1634b2a5ebc47bbc Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 17:42:25 -0700 Subject: [PATCH] Add tests for adding/removing an exchange called by owner --- .../staking/test/unit_tests/exchange_test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contracts/staking/test/unit_tests/exchange_test.ts b/contracts/staking/test/unit_tests/exchange_test.ts index b225d0c055..6f21999d87 100644 --- a/contracts/staking/test/unit_tests/exchange_test.ts +++ b/contracts/staking/test/unit_tests/exchange_test.ts @@ -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, {