@@ -6523,14 +6523,8 @@ describe("TokenStaking", () => {
6523
6523
} )
6524
6524
6525
6525
it ( "should add two slashing events" , async ( ) => {
6526
- expect ( await tokenStaking . slashingQueue ( 0 ) ) . to . deep . equal ( [
6527
- stakingProvider . address ,
6528
- amount ,
6529
- ] )
6530
- expect ( await tokenStaking . slashingQueue ( 1 ) ) . to . deep . equal ( [
6531
- otherStaker . address ,
6532
- amountToSlash ,
6533
- ] )
6526
+ await assertSlashingQueue ( 0 , stakingProvider . address , amount )
6527
+ await assertSlashingQueue ( 1 , otherStaker . address , amountToSlash )
6534
6528
expect ( await tokenStaking . getSlashingQueueLength ( ) ) . to . equal ( 2 )
6535
6529
} )
6536
6530
} )
@@ -6587,14 +6581,8 @@ describe("TokenStaking", () => {
6587
6581
} )
6588
6582
6589
6583
it ( "should add two slashing events" , async ( ) => {
6590
- expect ( await tokenStaking . slashingQueue ( 0 ) ) . to . deep . equal ( [
6591
- stakingProvider . address ,
6592
- amountToSlash ,
6593
- ] )
6594
- expect ( await tokenStaking . slashingQueue ( 1 ) ) . to . deep . equal ( [
6595
- otherStaker . address ,
6596
- amountToSlash ,
6597
- ] )
6584
+ await assertSlashingQueue ( 0 , stakingProvider . address , amountToSlash )
6585
+ await assertSlashingQueue ( 1 , otherStaker . address , amountToSlash )
6598
6586
expect ( await tokenStaking . getSlashingQueueLength ( ) ) . to . equal ( 2 )
6599
6587
} )
6600
6588
@@ -6668,14 +6656,8 @@ describe("TokenStaking", () => {
6668
6656
} )
6669
6657
6670
6658
it ( "should add two slashing events" , async ( ) => {
6671
- expect ( await tokenStaking . slashingQueue ( 0 ) ) . to . deep . equal ( [
6672
- otherStaker . address ,
6673
- amountToSlash ,
6674
- ] )
6675
- expect ( await tokenStaking . slashingQueue ( 1 ) ) . to . deep . equal ( [
6676
- stakingProvider . address ,
6677
- amountToSlash ,
6678
- ] )
6659
+ await assertSlashingQueue ( 0 , otherStaker . address , amountToSlash )
6660
+ await assertSlashingQueue ( 1 , stakingProvider . address , amountToSlash )
6679
6661
expect ( await tokenStaking . getSlashingQueueLength ( ) ) . to . equal ( 2 )
6680
6662
} )
6681
6663
@@ -6707,10 +6689,7 @@ describe("TokenStaking", () => {
6707
6689
} )
6708
6690
6709
6691
it ( "should add one slashing event" , async ( ) => {
6710
- expect ( await tokenStaking . slashingQueue ( 0 ) ) . to . deep . equal ( [
6711
- stakingProvider . address ,
6712
- amountToSlash ,
6713
- ] )
6692
+ await assertSlashingQueue ( 0 , stakingProvider . address , amountToSlash )
6714
6693
expect ( await tokenStaking . getSlashingQueueLength ( ) ) . to . equal ( 1 )
6715
6694
} )
6716
6695
@@ -6749,10 +6728,7 @@ describe("TokenStaking", () => {
6749
6728
} )
6750
6729
6751
6730
it ( "should add one slashing event" , async ( ) => {
6752
- expect ( await tokenStaking . slashingQueue ( 0 ) ) . to . deep . equal ( [
6753
- otherStaker . address ,
6754
- amountToSlash ,
6755
- ] )
6731
+ await assertSlashingQueue ( 0 , otherStaker . address , amountToSlash )
6756
6732
} )
6757
6733
6758
6734
it ( "should keep index of queue unchanged" , async ( ) => {
@@ -7646,4 +7622,19 @@ describe("TokenStaking", () => {
7646
7622
"invalid undelegatedAt"
7647
7623
) . to . equal ( expectedUndelegatedAt )
7648
7624
}
7625
+
7626
+ async function assertSlashingQueue (
7627
+ index ,
7628
+ expectedStakingProviderAddress ,
7629
+ expectedAmount
7630
+ ) {
7631
+ expect (
7632
+ ( await tokenStaking . slashingQueue ( index ) ) . stakingProvider ,
7633
+ "invalid stakingProvider"
7634
+ ) . to . equal ( expectedStakingProviderAddress )
7635
+ expect (
7636
+ ( await tokenStaking . slashingQueue ( index ) ) . amount ,
7637
+ "invalid amount"
7638
+ ) . to . equal ( expectedAmount )
7639
+ }
7649
7640
} )
0 commit comments