@@ -111,6 +111,61 @@ describe('Action Validation', () => {
111111 expect ( isValidActionInput ( missingDeploymentID ) ) . toBe ( false )
112112 } )
113113
114+ test ( 'validates PRESENT_POI action' , ( ) => {
115+ const validPresentPOI : ActionInput = {
116+ ...baseAction ,
117+ type : ActionType . PRESENT_POI ,
118+ deploymentID : 'Qmtest' ,
119+ allocationID : '0x1234567890123456789012345678901234567890' ,
120+ } as ActionInput
121+
122+ expect ( isValidActionInput ( validPresentPOI ) ) . toBe ( true )
123+
124+ // Missing allocationID
125+ const missingAllocationID : ActionInput = {
126+ ...baseAction ,
127+ type : ActionType . PRESENT_POI ,
128+ deploymentID : 'Qmtest' ,
129+ } as ActionInput
130+
131+ expect ( isValidActionInput ( missingAllocationID ) ) . toBe ( false )
132+
133+ // Missing deploymentID
134+ const missingDeploymentID : ActionInput = {
135+ ...baseAction ,
136+ type : ActionType . PRESENT_POI ,
137+ allocationID : '0x1234567890123456789012345678901234567890' ,
138+ } as ActionInput
139+
140+ expect ( isValidActionInput ( missingDeploymentID ) ) . toBe ( false )
141+
142+ // With POI provided, must also have publicPOI and poiBlockNumber
143+ const withPoiButMissingPublicPOI = {
144+ ...baseAction ,
145+ type : ActionType . PRESENT_POI ,
146+ deploymentID : 'Qmtest' ,
147+ allocationID : '0x1234567890123456789012345678901234567890' ,
148+ poi : '0x' + 'ab' . repeat ( 32 ) ,
149+ isLegacy : false ,
150+ }
151+
152+ expect ( isValidActionInput ( withPoiButMissingPublicPOI ) ) . toBe ( false )
153+
154+ // With all POI fields provided
155+ const withAllPoiFields = {
156+ ...baseAction ,
157+ type : ActionType . PRESENT_POI ,
158+ deploymentID : 'Qmtest' ,
159+ allocationID : '0x1234567890123456789012345678901234567890' ,
160+ poi : '0x' + 'ab' . repeat ( 32 ) ,
161+ publicPOI : '0x' + 'cd' . repeat ( 32 ) ,
162+ poiBlockNumber : 12345 ,
163+ isLegacy : false ,
164+ }
165+
166+ expect ( isValidActionInput ( withAllPoiFields ) ) . toBe ( true )
167+ } )
168+
114169 test ( 'validates common required fields (source, reason, status, priority)' , ( ) => {
115170 // Missing status
116171 const missingStatus = {
0 commit comments