@@ -83,6 +83,8 @@ const LATEST_RESULT_REQUIRED = [
8383 'targetUrl' ,
8484 'failedStepIndex' ,
8585 'failureKind' ,
86+ 'verdict' ,
87+ 'executionStatus' ,
8688 'summary' ,
8789] as const ;
8890// `targetUrlSource` (D1) is OPTIONAL — present on backends that shipped the D1
@@ -109,6 +111,15 @@ const FAILURE_KINDS = new Set<unknown>([
109111 'unknown' ,
110112 null ,
111113] ) ;
114+ const VERDICTS = new Set < unknown > ( [ 'passed' , 'failed' , 'blocked' , 'cancelled' , 'unknown' , null ] ) ;
115+ const EXECUTION_STATUSES = new Set < unknown > ( [
116+ 'queued' ,
117+ 'running' ,
118+ 'completed' ,
119+ 'cancelled' ,
120+ 'error' ,
121+ 'unknown' ,
122+ ] ) ;
112123
113124function expectKeysMatch ( value : Record < string , unknown > , allowed : Set < string > , label : string ) {
114125 for ( const key of Object . keys ( value ) ) {
@@ -178,17 +189,6 @@ function validateTestStepList(value: unknown, label = 'TestStepList'): void {
178189 }
179190}
180191
181- function validateResultSummary ( value : unknown , label : string ) : void {
182- expect ( value , label ) . toBeTypeOf ( 'object' ) ;
183- expect ( value , label ) . not . toBeNull ( ) ;
184- const obj = value as Record < string , unknown > ;
185- expectKeysMatch ( obj , new Set ( [ 'passed' , 'failed' , 'skipped' ] ) , label ) ;
186- for ( const k of [ 'passed' , 'failed' , 'skipped' ] ) {
187- expect ( typeof obj [ k ] , `${ label } .${ k } ` ) . toBe ( 'number' ) ;
188- expect ( ( obj [ k ] as number ) >= 0 , `${ label } .${ k } >= 0` ) . toBe ( true ) ;
189- }
190- }
191-
192192function validateLatestResult ( value : unknown , label = 'LatestResult' ) : void {
193193 expect ( value , `${ label } : must be an object` ) . toBeTypeOf ( 'object' ) ;
194194 expect ( value , `${ label } : must not be null` ) . not . toBeNull ( ) ;
@@ -215,7 +215,9 @@ function validateLatestResult(value: unknown, label = 'LatestResult'): void {
215215 expect ( ( obj . failedStepIndex as number ) >= 1 , `${ label } .failedStepIndex >= 1` ) . toBe ( true ) ;
216216 }
217217 expect ( FAILURE_KINDS . has ( obj . failureKind ) , `${ label } .failureKind` ) . toBe ( true ) ;
218- validateResultSummary ( obj . summary , `${ label } .summary` ) ;
218+ expect ( VERDICTS . has ( obj . verdict ) , `${ label } .verdict` ) . toBe ( true ) ;
219+ expect ( EXECUTION_STATUSES . has ( obj . executionStatus ) , `${ label } .executionStatus` ) . toBe ( true ) ;
220+ expect ( typeof obj . summary , `${ label } .summary` ) . toBe ( 'string' ) ;
219221}
220222
221223describe ( 'P4 schema contract — fixtures match the OpenAPI shapes' , ( ) => {
0 commit comments