fix(03): update event lookup test mocks for CR-01/CR-02 query-chain changes
The CR-01 fix appended .orderBy().limit(1) to the edit/delete event lookups and CR-02 added .innerJoin(calendars).limit(1) to the freshest-etag re-read. The existing test doubles terminated the mock chain at .where(), so the new chain calls hit undefined methods → handlers caught the throw and returned 503 (events.test.ts) and the worker skipped the PUT (outboxWorker.test.ts). Extend the mocks to match the corrected production chains. Behaviour-preserving: mockWhereCalEvents stays the awaited terminal so etag override assertions still drive. 8 failing tests now green; full suite: api 103, pwa 141.
This commit is contained in:
@@ -139,7 +139,15 @@ function wireMockChain() {
|
||||
return { where: vi.fn().mockResolvedValue([FAKE_CRED_ROW]) }
|
||||
}
|
||||
if (tableName === 'calendar_events') {
|
||||
return { where: mockWhereCalEvents }
|
||||
// CR-02: the freshest-etag re-read now scopes to the writing member's calendar:
|
||||
// .from(calendarEvents).innerJoin(calendars, ...).where(...).limit(1)
|
||||
// mockWhereCalEvents stays the awaited terminal (returned by .limit) so existing
|
||||
// mockWhereCalEvents.mockResolvedValue([{ etag }]) overrides still drive the etag.
|
||||
return {
|
||||
innerJoin: vi.fn().mockReturnValue({
|
||||
where: vi.fn().mockReturnValue({ limit: mockWhereCalEvents }),
|
||||
}),
|
||||
}
|
||||
}
|
||||
return { where: mockWherePending }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user