@@ -175,32 +175,51 @@ describe("Staking", async () => {
175175 } ) ;
176176 } ) ;
177177
178- describe ( "When juror has no NFT " , async ( ) => {
178+ describe ( "When juror NFT is not set " , async ( ) => {
179179 before ( "Setup" , async ( ) => {
180180 await deployUnhappy ( ) ;
181+ await core . changeJurorNft ( ethers . ZeroAddress ) ;
181182 } ) ;
182183
183- it ( "Should not be able to stake" , async ( ) => {
184- await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
185- await expect ( core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) ) . to . be . revertedWithCustomError (
186- core ,
187- "NotEligibleForStaking"
188- ) ;
184+ describe ( "When juror has no NFT" , async ( ) => {
185+ it ( "Should be able to stake" , async ( ) => {
186+ await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
187+ await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
188+ . to . emit ( sortition , "StakeSet" )
189+ . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
190+ expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1000 ) ) ;
191+ } ) ;
189192 } ) ;
190193 } ) ;
191194
192- describe ( "When juror does have a NFT" , async ( ) => {
193- before ( "Setup" , async ( ) => {
194- await deployUnhappy ( ) ;
195- await nft . safeMint ( juror . address ) ;
195+ describe ( "When juror NFT is set" , async ( ) => {
196+ describe ( "When juror has no NFT" , async ( ) => {
197+ before ( "Setup" , async ( ) => {
198+ await deployUnhappy ( ) ;
199+ } ) ;
200+
201+ it ( "Should not be able to stake" , async ( ) => {
202+ await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
203+ await expect ( core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) ) . to . be . revertedWithCustomError (
204+ core ,
205+ "NotEligibleForStaking"
206+ ) ;
207+ } ) ;
196208 } ) ;
197209
198- it ( "Should be able to stake" , async ( ) => {
199- await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
200- await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
201- . to . emit ( sortition , "StakeSet" )
202- . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
203- expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1000 ) ) ;
210+ describe ( "When juror does have a NFT" , async ( ) => {
211+ before ( "Setup" , async ( ) => {
212+ await deployUnhappy ( ) ;
213+ await nft . safeMint ( juror . address ) ;
214+ } ) ;
215+
216+ it ( "Should be able to stake" , async ( ) => {
217+ await pnk . connect ( juror ) . approve ( core . target , PNK ( 1000 ) ) ;
218+ await expect ( await core . connect ( juror ) . setStake ( 1 , PNK ( 1000 ) ) )
219+ . to . emit ( sortition , "StakeSet" )
220+ . withArgs ( juror . address , 1 , PNK ( 1000 ) , PNK ( 1000 ) ) ;
221+ expect ( await sortition . totalStaked ( ) ) . to . be . equal ( PNK ( 1000 ) ) ;
222+ } ) ;
204223 } ) ;
205224 } ) ;
206225
0 commit comments