@@ -46,4 +46,76 @@ describe("Dispute Functions", () => {
4646 expect ( response . txHash ) . to . be . a ( "string" ) . and . not . empty ;
4747 expect ( response . disputeId ) . to . be . a ( "bigint" ) ;
4848 } ) ;
49+
50+ it ( "should throw error when liveness is out of bounds" , async ( ) => {
51+ const minLiveness = await clientA . dispute . arbitrationPolicyUmaReadOnlyClient . minLiveness ( ) ;
52+ const raiseDisputeRequest : RaiseDisputeRequest = {
53+ targetIpId : ipIdB ,
54+ cid : "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR" ,
55+ targetTag : "IMPROPER_REGISTRATION" ,
56+ liveness : Number ( minLiveness ) - 1 , // Below minimum
57+ bond : 0 ,
58+ txOptions : { waitForTransaction : true } ,
59+ } ;
60+
61+ await expect ( clientA . dispute . raiseDispute ( raiseDisputeRequest ) ) . to . be . rejectedWith (
62+ `Liveness must be between` ,
63+ ) ;
64+ } ) ;
65+
66+ it ( "should throw error when bond exceeds maximum" , async ( ) => {
67+ const maxBonds = await clientA . dispute . arbitrationPolicyUmaReadOnlyClient . maxBonds ( {
68+ token : erc20TokenAddress [ homer ] ,
69+ } ) ;
70+
71+ const raiseDisputeRequest : RaiseDisputeRequest = {
72+ targetIpId : ipIdB ,
73+ cid : "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR" ,
74+ targetTag : "IMPROPER_REGISTRATION" ,
75+ liveness : 2592000 ,
76+ bond : 2000000000000000000 ,
77+ txOptions : {
78+ waitForTransaction : true ,
79+ } ,
80+ } ;
81+
82+ await expect ( clientA . dispute . raiseDispute ( raiseDisputeRequest ) ) . to . be . rejectedWith (
83+ `Bonds must be less than` ,
84+ ) ;
85+ } ) ;
86+
87+ it ( "should throw error for non-whitelisted dispute tag" , async ( ) => {
88+ const raiseDisputeRequest : RaiseDisputeRequest = {
89+ targetIpId : ipIdB ,
90+ cid : "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR" ,
91+ targetTag : "INVALID_TAG" ,
92+ liveness : 2592000 ,
93+ bond : 0 ,
94+ txOptions : { waitForTransaction : true } ,
95+ } ;
96+
97+ await expect ( clientA . dispute . raiseDispute ( raiseDisputeRequest ) ) . to . be . rejectedWith (
98+ `The target tag INVALID_TAG is not whitelisted` ,
99+ ) ;
100+ } ) ;
101+
102+ it ( "it should cancel a dispute" , async ( ) => {
103+ // First raise a dispute
104+ const raiseResponse = await clientA . dispute . raiseDispute ( {
105+ targetIpId : ipIdB ,
106+ cid : "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR" ,
107+ targetTag : "IMPROPER_REGISTRATION" ,
108+ liveness : 2592000 ,
109+ bond : 0 ,
110+ txOptions : { waitForTransaction : true } ,
111+ } ) ;
112+
113+ // Then you shouldnn't be able to cancel it
114+ expect (
115+ clientA . dispute . cancelDispute ( {
116+ disputeId : raiseResponse . disputeId ! ,
117+ txOptions : { waitForTransaction : true } ,
118+ } ) ,
119+ ) . to . be . rejected ;
120+ } ) ;
49121} ) ;
0 commit comments