add tests for chat log event cache handling

Covers the recently fixed bugs (batch continuation on unknown convos,
accept status propagation to 'all'-status caches, rev guard against
stale writes) plus core per-log-type cache behaviors. Fixture builders
are shared for other chat test suites.

Stubs the bottom-sheet native module in jest setup: it reads
Platform.Version at import time, which jest-expo leaves undefined,
crashing any test that imports the chat/session chain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-06-12 11:22:33 +03:00
parent 4206010900
commit 776822afcd
3 changed files with 876 additions and 0 deletions
+17
View File
@@ -23,6 +23,7 @@ jest.mock('react-native-safe-area-context', () => {
SafeAreaProvider: jest.fn().mockImplementation(({children}) => children),
SafeAreaConsumer: jest
.fn()
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
.mockImplementation(({children}) => children(inset)),
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
}
@@ -106,3 +107,19 @@ jest.mock('expo-modules-core', () => ({
jest.mock('expo-localization', () => ({
getLocales: () => [],
}))
// The bottom-sheet native component reads Platform.Version at import time,
// which the jest-expo preset leaves undefined, crashing any test that pulls in
// the chat/session import chain. Stub the native module so it's never
// evaluated under jest.
jest.mock('../modules/bottom-sheet', () => ({
__esModule: true,
BottomSheet: () => null,
BottomSheetNativeComponent: class {},
BottomSheetOutlet: () => null,
BottomSheetPortalProvider: jest
.fn()
.mockImplementation(({children}) => children),
BottomSheetProvider: jest.fn().mockImplementation(({children}) => children),
BottomSheetSnapPoint: {Hidden: 0, Partial: 1, Full: 2},
}))