diff --git a/contracts/staking/test/unit_tests/stake_test.ts b/contracts/staking/test/unit_tests/stake_test.ts index 4b196f6a8c..a444168a88 100644 --- a/contracts/staking/test/unit_tests/stake_test.ts +++ b/contracts/staking/test/unit_tests/stake_test.ts @@ -8,7 +8,6 @@ import { hexRandom, Numberish, shortZip, - toHex, } from '@0x/contracts-test-utils'; import { StakingRevertErrors } from '@0x/order-utils'; import { BigNumber } from '@0x/utils'; @@ -158,7 +157,7 @@ blockchainTests.resets('MixinStake unit tests', env => { describe('moveStake()', () => { const INVALID_POOL_ERROR = 'INVALID_POOL'; - const INVALID_POOL_ID = hexLeftPad(toHex(0)); + const INVALID_POOL_ID = hexLeftPad(0); const VALID_POOL_IDS = [hexRandom(), hexRandom()]; let delegatedStakeToPoolByOwnerSlots: string[]; let delegatedStakeByPoolIdSlots: string[]; @@ -199,6 +198,15 @@ blockchainTests.resets('MixinStake unit tests', env => { return expect(tx).to.revertWith(INVALID_POOL_ERROR); }); + it('throws if the "from" and "to" pools are invalid', async () => { + const tx = testContract.moveStake.awaitTransactionSuccessAsync( + { status: StakeStatus.Delegated, poolId: INVALID_POOL_ID }, + { status: StakeStatus.Delegated, poolId: INVALID_POOL_ID }, + getRandomInteger(0, 100e18), + ); + return expect(tx).to.revertWith(INVALID_POOL_ERROR); + }); + it('withdraws delegator rewards when "from" stake is delegated', async () => { const { logs } = await testContract.moveStake.awaitTransactionSuccessAsync( { status: StakeStatus.Delegated, poolId: VALID_POOL_IDS[0] },