@@ -4,6 +4,7 @@ import { mockEventSetSomeday1 } from "@core/__mocks__/v1/events/events.someday.1
44import { MapEvent , gEventToCompassEvent } from "@core/mappers/map.event" ;
55import { Schema_Event } from "@core/types/event.types" ;
66import { isBase , isExistingInstance } from "@core/util/event/event.util" ;
7+ import { createMockBaseEvent } from "@core/util/test/ccal.event.factory" ;
78import {
89 cleanupTestDb ,
910 setupTestDb ,
@@ -88,6 +89,31 @@ describe("Jan 2022: Many Formats", () => {
8889 const instances = result . filter ( isExistingInstance ) ;
8990 expect ( instances ) . toHaveLength ( gInstances . length ) ;
9091 } ) ;
92+
93+ it ( "excludes base calendar recurring events when someday=false" , async ( ) => {
94+ // Create a base calendar recurring event (isSomeday: false)
95+ const baseCalendarRecurringEvent = createMockBaseEvent ( {
96+ user : userId ,
97+ isSomeday : false ,
98+ } ) ;
99+
100+ // Insert the test event
101+ await mongoService . event . insertOne ( baseCalendarRecurringEvent ) ;
102+
103+ // Query for calendar events (not someday)
104+ const filter = getReadAllFilter ( userId , {
105+ start : "2023-10-01" ,
106+ end : "2023-10-31" ,
107+ } ) ;
108+ const result = await mongoService . event . find ( filter ) . toArray ( ) ;
109+
110+ // Should NOT include the base calendar recurring event
111+ const baseCalendarRecurringEvents = result . filter (
112+ ( e ) => isBase ( e ) && e . isSomeday === false ,
113+ ) ;
114+
115+ expect ( baseCalendarRecurringEvents ) . toHaveLength ( 0 ) ;
116+ } ) ;
91117 } ) ;
92118
93119 describe ( "finds events with exact same timestamps" , ( ) => {
@@ -298,6 +324,28 @@ describe("Jan 2022: Many Formats", () => {
298324 expect ( result [ 0 ] ?. title ) . toBe ( "Multi-Month 2" ) ;
299325 } ) ;
300326 } ) ;
327+
328+ it ( "includes base someday recurring events when someday query provided" , async ( ) => {
329+ // Create a base someday recurring event
330+ const baseSomedayRecurringEvent = createMockBaseEvent ( {
331+ user : userId ,
332+ isSomeday : true ,
333+ } ) ;
334+
335+ // Insert the test event
336+ await mongoService . event . insertOne ( baseSomedayRecurringEvent ) ;
337+
338+ // Query for someday events
339+ const filter = getReadAllFilter ( userId , { someday : "true" } ) ;
340+ const result = await mongoService . event . find ( filter ) . toArray ( ) ;
341+
342+ // Should include the base someday recurring event
343+ const baseSomedayRecurringEvents = result . filter (
344+ ( e ) => isBase ( e ) && e . isSomeday === true ,
345+ ) ;
346+
347+ expect ( baseSomedayRecurringEvents . length ) . toBeGreaterThan ( 0 ) ;
348+ } ) ;
301349 } ) ;
302350} ) ;
303351
0 commit comments