@@ -1031,8 +1031,9 @@ describe('ExclusiveGeyser', function () {
10311031 } )
10321032 describe ( 'with insufficient balance' , function ( ) {
10331033 it ( 'should fail' , async function ( ) {
1034+ // Exclusive stake condition fails first
10341035 await expect ( stake ( user , geyser , vault , stakingToken , stakeAmount . mul ( 2 ) ) ) . to . be . revertedWith (
1035- 'UniversalVault: insufficient balance ' ,
1036+ 'ExclusiveGeyser: expected exclusive stake ' ,
10361037 )
10371038 } )
10381039 } )
@@ -1123,7 +1124,7 @@ describe('ExclusiveGeyser', function () {
11231124 }
11241125 } )
11251126 it ( 'should fail' , async function ( ) {
1126- await expect ( stake ( user , geyser , vault , stakingToken , stakeAmount . div ( quantity ) ) ) . to . be . revertedWith (
1127+ await expect ( stake ( user , geyser , vault , stakingToken , 1 ) ) . to . be . revertedWith (
11271128 'Geyser: MAX_STAKES_PER_VAULT reached' ,
11281129 )
11291130 } )
@@ -1176,18 +1177,31 @@ describe('ExclusiveGeyser', function () {
11761177 ]
11771178 otherGeyser = await deployGeyser ( args , 'Geyser' )
11781179 await otherGeyser . connect ( admin ) . registerVaultFactory ( vaultFactory . address )
1179- await stake ( user , otherGeyser , vault , stakingToken , 1 )
1180+ await stake ( user , otherGeyser , vault , stakingToken , stakeAmount )
11801181 } )
11811182 it ( 'should fail' , async function ( ) {
11821183 await expect ( stake ( user , geyser , vault , stakingToken , stakeAmount ) ) . to . be . revertedWith (
11831184 'ExclusiveGeyser: expected exclusive stake' ,
11841185 )
1186+ expect ( await geyser . computeAvailableStakingBalance ( vault . address ) ) . to . eq ( 0 )
1187+ expect ( await vault . checkBalances ( ) ) . to . eq ( true )
11851188 } )
1186- it ( 'should not fail when there are no locks' , async function ( ) {
1187- await unstakeAndClaim ( user , otherGeyser , vault , stakingToken , 1 )
1188- await expect ( stake ( user , geyser , vault , stakingToken , stakeAmount ) ) . not . to . be . revertedWith (
1189- 'ExclusiveGeyser: expected exclusive stake' ,
1190- )
1189+
1190+ it ( 'should NOT fail when there is some unlocked amount' , async function ( ) {
1191+ await unstakeAndClaim ( user , otherGeyser , vault , stakingToken , 15 )
1192+ await expect ( stake ( user , geyser , vault , stakingToken , 14 ) ) . not . to . be . reverted
1193+ expect ( await geyser . computeAvailableStakingBalance ( vault . address ) ) . to . eq ( 1 )
1194+ expect ( await vault . checkBalances ( ) ) . to . eq ( true )
1195+ await expect ( stake ( user , geyser , vault , stakingToken , 1 ) ) . not . to . be . reverted
1196+ expect ( await geyser . computeAvailableStakingBalance ( vault . address ) ) . to . eq ( 0 )
1197+ expect ( await vault . checkBalances ( ) ) . to . eq ( true )
1198+ } )
1199+
1200+ it ( 'should NOT fail when there are no locks' , async function ( ) {
1201+ await unstakeAndClaim ( user , otherGeyser , vault , stakingToken , stakeAmount )
1202+ await expect ( stake ( user , geyser , vault , stakingToken , stakeAmount ) ) . not . to . be . reverted
1203+ expect ( await geyser . computeAvailableStakingBalance ( vault . address ) ) . to . eq ( 0 )
1204+ expect ( await vault . checkBalances ( ) ) . to . eq ( true )
11911205 } )
11921206 } )
11931207 } )
0 commit comments