@@ -292,6 +292,58 @@ describe("Jan 2022: Many Formats", () => {
292292 } ) ;
293293} ) ;
294294
295+ describe ( "Edge Cases" , ( ) => {
296+ let connection : MongoClient ;
297+ let db : Db ;
298+ let eventCollection : Collection < Schema_Event > ;
299+
300+ beforeAll ( async ( ) => {
301+ connection = await MongoClient . connect ( process . env [ "MONGO_URL" ] as string ) ;
302+ db = await connection . db ( ) ;
303+ eventCollection = db . collection ( "event" ) ;
304+ } ) ;
305+
306+ afterAll ( async ( ) => {
307+ await connection . close ( ) ;
308+ } ) ;
309+
310+ it ( "should return both timed and all-day events when filtering by date range that includes both" , async ( ) => {
311+ await eventCollection . deleteMany ( { } ) ;
312+ await eventCollection . insertMany ( [
313+ {
314+ _id : "timed-event-id" ,
315+ user : "test-user" ,
316+ title : "Timed Event" ,
317+ isAllDay : false ,
318+ isSomeday : false ,
319+ startDate : "2025-02-02T00:00:00+03:00" ,
320+ endDate : "2025-02-02T01:01:00+03:00" ,
321+ } ,
322+ {
323+ _id : "allday-event-id" ,
324+ user : "test-user" ,
325+ title : "All-day Event" ,
326+ isAllDay : true ,
327+ isSomeday : false ,
328+ startDate : "2025-02-02T00:00:00+03:00" ,
329+ endDate : "2025-02-02T01:00:00+03:00" ,
330+ } ,
331+ ] ) ;
332+
333+ const filter = getReadAllFilter ( "test-user" , {
334+ start : "2025-02-02T00:00:00+03:00" ,
335+ end : "2025-02-08T23:59:59+03:00" ,
336+ } ) ;
337+
338+ const result = await eventCollection . find ( filter ) . toArray ( ) ;
339+ const titles = result . map ( ( e ) => e . title ) ;
340+
341+ expect ( titles . includes ( "Timed Event" ) ) . toBe ( true ) ;
342+ expect ( titles . includes ( "All-day Event" ) ) . toBe ( true ) ;
343+ expect ( result ) . toHaveLength ( 2 ) ;
344+ } ) ;
345+ } ) ;
346+
295347const _jan1ToJan3Assertions = ( result : [ ] ) => {
296348 const titles = result . map ( ( e ) => e . title ) ;
297349
0 commit comments