-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Where did this happen?
No response
Expected Behavior
No response
Current Behavior
The primary failure is caused by a TypeError: Cannot read properties of undefined (reading 'request') in packages/web/src/store/sagas.ts at lines where takeLatest is used with .actions.request (see logs and code). This happens because, in your test (packages/web/src/views/Forms/hooks/useSaveEventForm.test.ts), the createEventSlice, editEventSlice, etc., are mocked and expected to have an actions property containing the request key. However, the actual test mock only defines request on some slices, leaving others as empty reducers.
Solution: Ensure that all slices used in packages/web/src/store/sagas.ts (such as getDayEventsSlice, getWeekEventsSlice, getCurrentMonthEventsSlice, etc.) are properly mocked in the test file, each with an actions object containing a request property (even if it’s just a jest.fn()). Update your mock for these slices:
Replace in your test mock (useSaveEventForm.test.ts):
Steps to Reproduce
No response
Possible Solution
Replace in your test mock (useSaveEventForm.test.ts):
getDayEventsSlice: { reducer: jest.fn(() => ({})) },
getSomedayEventsSlice: { reducer: jest.fn(() => ({})) },
getWeekEventsSlice: { reducer: jest.fn(() => ({})) },
getCurrentMonthEventsSlice: { reducer: jest.fn(() => ({})) },
With
getDayEventsSlice: { actions: { request: jest.fn() }, reducer: jest.fn(() => ({})) },
getSomedayEventsSlice: { actions: { request: jest.fn() }, reducer: jest.fn(() => ({})) },
getWeekEventsSlice: { actions: { request: jest.fn() }, reducer: jest.fn(() => ({})) },
getCurrentMonthEventsSlice: { actions: { request: jest.fn() }, reducer: jest.fn(() => ({})) },
Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status