@@ -189,6 +189,21 @@ describe("RunEvent Schema", () => {
189189 expect ( result . startTime . toISOString ( ) ) . toBe ( "2024-03-14T00:00:00.000Z" ) ;
190190 } ) ;
191191
192+ it ( "handles 19-digit nanosecond startTime strings" , ( ) => {
193+ const event = { ...validEvent , startTime : "1710374400000000000" } ;
194+ const result = RunEvent . parse ( event ) ;
195+ expect ( result . startTime ) . toBeInstanceOf ( Date ) ;
196+ // 1710374400000000000 ns = 1710374400000 ms = 2024-03-14T00:00:00Z
197+ expect ( result . startTime . toISOString ( ) ) . toBe ( "2024-03-14T00:00:00.000Z" ) ;
198+ } ) ;
199+
200+ it ( "handles bigint nanosecond startTime" , ( ) => {
201+ const event = { ...validEvent , startTime : 1710374400000000000n } ;
202+ const result = RunEvent . parse ( event as any ) ;
203+ expect ( result . startTime ) . toBeInstanceOf ( Date ) ;
204+ expect ( result . startTime . toISOString ( ) ) . toBe ( "2024-03-14T00:00:00.000Z" ) ;
205+ } ) ;
206+
192207 it ( "allows optional/null parentId" , ( ) => {
193208 const eventWithoutParent = { ...validEvent } ;
194209 delete ( eventWithoutParent as any ) . parentId ;
@@ -197,6 +212,26 @@ describe("RunEvent Schema", () => {
197212 const eventWithNullParent = { ...validEvent , parentId : null } ;
198213 expect ( RunEvent . safeParse ( eventWithNullParent ) . success ) . toBe ( true ) ;
199214 } ) ;
215+
216+ it ( "allows nullish attemptNumber" , ( ) => {
217+ const eventWithNullAttempt = { ...validEvent , attemptNumber : null } ;
218+ const result = RunEvent . safeParse ( eventWithNullAttempt ) ;
219+ expect ( result . success ) . toBe ( true ) ;
220+ if ( result . success ) {
221+ expect ( result . data . attemptNumber ) . toBe ( null ) ;
222+ }
223+
224+ const eventWithoutAttempt = { ...validEvent } ;
225+ delete ( eventWithoutAttempt as any ) . attemptNumber ;
226+ const result2 = RunEvent . safeParse ( eventWithoutAttempt ) ;
227+ expect ( result2 . success ) . toBe ( true ) ;
228+ } ) ;
229+
230+ it ( "supports taskSlug" , ( ) => {
231+ const eventWithSlug = { ...validEvent , taskSlug : "my-task" } ;
232+ const result = RunEvent . parse ( eventWithSlug ) ;
233+ expect ( result . taskSlug ) . toBe ( "my-task" ) ;
234+ } ) ;
200235} ) ;
201236
202237describe ( "ListRunEventsResponse Schema" , ( ) => {
0 commit comments