@@ -222,6 +222,46 @@ describe("RunEvent Schema", () => {
222222 expect ( result . success ) . toBe ( false ) ;
223223 } ) ;
224224
225+ describe ( "startTime edge cases" , ( ) => {
226+ it ( "should handle whitespace-padded strings" , ( ) => {
227+ const result = RunEvent . safeParse ( {
228+ ...validEvent ,
229+ startTime : " 2024-03-14T00:00:00Z " ,
230+ } ) ;
231+ expect ( result . success ) . toBe ( true ) ;
232+ if ( result . success ) {
233+ expect ( result . data . startTime . toISOString ( ) ) . toBe ( "2024-03-14T00:00:00.000Z" ) ;
234+ }
235+ } ) ;
236+
237+ it ( "should handle whitespace-padded nanosecond strings" , ( ) => {
238+ const result = RunEvent . safeParse ( {
239+ ...validEvent ,
240+ startTime : " 1710374400000000000 " ,
241+ } ) ;
242+ expect ( result . success ) . toBe ( true ) ;
243+ if ( result . success ) {
244+ expect ( result . data . startTime . toISOString ( ) ) . toBe ( "2024-03-14T00:00:00.000Z" ) ;
245+ }
246+ } ) ;
247+
248+ it ( "should fail on empty string" , ( ) => {
249+ const result = RunEvent . safeParse ( {
250+ ...validEvent ,
251+ startTime : "" ,
252+ } ) ;
253+ expect ( result . success ) . toBe ( false ) ;
254+ } ) ;
255+
256+ it ( "should fail on whitespace-only string" , ( ) => {
257+ const result = RunEvent . safeParse ( {
258+ ...validEvent ,
259+ startTime : " " ,
260+ } ) ;
261+ expect ( result . success ) . toBe ( false ) ;
262+ } ) ;
263+ } ) ;
264+
225265 it ( "allows optional/null parentId" , ( ) => {
226266 const eventWithoutParent = { ...validEvent } ;
227267 delete ( eventWithoutParent as any ) . parentId ;
0 commit comments