@@ -704,25 +704,14 @@ func TestCheckDisputeForIds(t *testing.T) {
704
704
txnOpts , _ := bind .NewKeyedTransactorWithChainID (privateKey , big .NewInt (31337 ))
705
705
706
706
type args struct {
707
- isEqual bool
708
- isEqualInt int
709
707
idsInProposedBlock []uint16
710
708
revealedCollectionIds []uint16
711
- isSorted bool
712
- index0 int
713
- index1 int
714
709
DisputeOnOrderOfIds * Types.Transaction
715
710
DisputeOnOrderOfIdsErr error
716
- isMissing bool
717
- isMissingInt int
718
711
incrementedGasLimit uint64
719
712
incrementedGasLimitErr error
720
- missingCollectionId uint16
721
713
DisputeCollectionIdShouldBePresent * Types.Transaction
722
714
DisputeCollectionIdShouldBePresentErr error
723
- isPresent bool
724
- positionOfPresentValue int
725
- presentCollectionId uint16
726
715
DisputeCollectionIdShouldBeAbsent * Types.Transaction
727
716
DisputeCollectionIdShouldBeAbsentErr error
728
717
}
@@ -733,59 +722,61 @@ func TestCheckDisputeForIds(t *testing.T) {
733
722
wantErr bool
734
723
}{
735
724
{
736
- name : "Test 1: When CheckDisputeForIds executes successfully and check if the error is in sorted ids " ,
725
+ name : "Test 1: When CheckDisputeForIds executes successfully with sorted Ids dispute case " ,
737
726
args : args {
738
- isEqual : false ,
739
- idsInProposedBlock : []uint16 {1 , 2 , 3 },
727
+ idsInProposedBlock : []uint16 {1 , 3 , 2 },
740
728
revealedCollectionIds : []uint16 {1 , 2 , 3 },
741
- isSorted : false ,
742
729
DisputeOnOrderOfIds : & Types.Transaction {},
743
730
},
744
731
want : & Types.Transaction {},
745
732
wantErr : false ,
746
733
},
747
734
{
748
- name : "Test 2: When CheckDisputeForIds executes successfully and check if the error is collectionIdShouldBePresent " ,
735
+ name : "Test 2: When CheckDisputeForIds executes successfully with collectionIdShouldBePresent dispute case " ,
749
736
args : args {
750
- isEqual : false ,
751
- idsInProposedBlock : []uint16 {1 , 2 , 3 },
752
- isSorted : true ,
753
- isMissing : true ,
737
+ idsInProposedBlock : []uint16 {1 , 2 , 4 },
738
+ revealedCollectionIds : []uint16 {1 , 2 , 3 },
754
739
DisputeCollectionIdShouldBePresent : & Types.Transaction {},
755
740
},
756
741
want : & Types.Transaction {},
757
742
wantErr : false ,
758
743
},
759
744
{
760
- name : "Test 3: When there is an error in incrementalGasLimit" ,
745
+ name : "Test 3: When its a collectionIdShouldBePresent dispute case and their is an error in incrementalGasLimit" ,
761
746
args : args {
762
- isEqual : false ,
763
- idsInProposedBlock : []uint16 {1 , 2 , 3 },
764
- isSorted : true ,
765
- isMissing : true ,
766
- incrementedGasLimitErr : errors .New ("error in incremented gas limit" ),
767
- DisputeCollectionIdShouldBePresent : & Types.Transaction {},
747
+ idsInProposedBlock : []uint16 {1 , 2 , 4 },
748
+ revealedCollectionIds : []uint16 {1 , 2 , 3 },
749
+ incrementedGasLimitErr : errors .New ("error in incremented gas limit" ),
768
750
},
769
751
want : nil ,
770
752
wantErr : true ,
771
753
},
772
754
{
773
- name : "Test 4: When there is no error " ,
755
+ name : "Test 4: When CheckDisputeForIds executes successfully with collectionIdShouldBeAbsent case " ,
774
756
args : args {
775
- isEqual : false ,
776
- idsInProposedBlock : []uint16 {1 , 2 , 3 },
777
- isSorted : true ,
778
- isMissing : false ,
779
- isPresent : false ,
757
+ idsInProposedBlock : []uint16 {1 , 2 , 3 , 4 },
758
+ revealedCollectionIds : []uint16 {1 , 2 , 3 },
780
759
DisputeCollectionIdShouldBeAbsent : & Types.Transaction {},
781
760
},
782
- want : nil ,
761
+ want : & Types. Transaction {} ,
783
762
wantErr : false ,
784
763
},
764
+ {
765
+ name : "Test 5: When its a collectionIdShouldBeAbsent dispute case and their is an error in incrementalGasLimit" ,
766
+ args : args {
767
+ idsInProposedBlock : []uint16 {1 , 2 , 3 , 4 },
768
+ revealedCollectionIds : []uint16 {1 , 2 , 3 },
769
+ DisputeCollectionIdShouldBeAbsent : & Types.Transaction {},
770
+ incrementedGasLimitErr : errors .New ("error in incremented gas limit" ),
771
+ },
772
+ want : nil ,
773
+ wantErr : true ,
774
+ },
785
775
{
786
776
name : "Test 5: When there is no dispute" ,
787
777
args : args {
788
- isEqual : true ,
778
+ idsInProposedBlock : []uint16 {1 , 2 , 3 },
779
+ revealedCollectionIds : []uint16 {1 , 2 , 3 },
789
780
},
790
781
want : nil ,
791
782
wantErr : false ,
@@ -802,14 +793,10 @@ func TestCheckDisputeForIds(t *testing.T) {
802
793
blockManagerUtils = blockManagerUtilsMock
803
794
utilsInterface = utilsPkgMock
804
795
805
- utilsPkgMock .On ("IsEqualByte" , mock .Anything , mock .Anything ).Return (tt .args .isEqual , tt .args .isEqualInt )
806
- utilsPkgMock .On ("IsSorted" , mock .Anything ).Return (tt .args .isSorted , tt .args .index0 , tt .args .index1 )
807
796
utilsMock .On ("GetTxnOpts" , mock .AnythingOfType ("types.TransactionOptions" )).Return (txnOpts )
808
797
blockManagerUtilsMock .On ("DisputeOnOrderOfIds" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .DisputeOnOrderOfIds , tt .args .DisputeOnOrderOfIdsErr )
809
- utilsPkgMock .On ("IsMissing" , mock .Anything , mock .Anything ).Return (tt .args .isMissing , tt .args .isMissingInt , tt .args .missingCollectionId )
810
798
utilsPkgMock .On ("IncreaseGasLimitValue" , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .incrementedGasLimit , tt .args .incrementedGasLimitErr )
811
799
blockManagerUtilsMock .On ("DisputeCollectionIdShouldBePresent" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .DisputeCollectionIdShouldBePresent , tt .args .DisputeCollectionIdShouldBePresentErr )
812
- utilsPkgMock .On ("IsMissing" , mock .Anything , mock .Anything ).Return (tt .args .isPresent , tt .args .positionOfPresentValue , tt .args .presentCollectionId )
813
800
blockManagerUtilsMock .On ("DisputeCollectionIdShouldBeAbsent" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .DisputeCollectionIdShouldBeAbsent , tt .args .DisputeCollectionIdShouldBeAbsentErr )
814
801
utilsPkgMock .On ("IncreaseGasLimitValue" , mock .Anything , mock .Anything , mock .Anything ).Return (uint64 (2000 ), nil )
815
802
ut := & UtilsStruct {}
0 commit comments