add expo-secure-store dependency and jest mocks

Adds expo-secure-store (~15.0.8, the SDK 54 bundled version) plus its
config plugin, which excludes the SecureStore keystore from Android
auto backup.

Also adds two global jest mocks: expo-secure-store, whose real entry
reads accessibility constants off the native module at import time, and
react-native-mmkv, since #/storage constructs an MMKV instance at module
scope. File-local mocks continue to take precedence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-15 18:58:35 +03:00
parent 1f5c698165
commit 93aa06077a
4 changed files with 62 additions and 0 deletions
+48
View File
@@ -28,6 +28,36 @@ jest.mock('react-native-safe-area-context', () => {
}
})
jest.mock('react-native-mmkv', () => ({
MMKV: class MMKV {
_store = new Map()
set(key, value) {
this._store.set(key, value)
}
getString(key) {
return this._store.get(key)
}
delete(key) {
this._store.delete(key)
}
clearAll() {
this._store.clear()
}
getAllKeys() {
return Array.from(this._store.keys())
}
addOnValueChangedListener() {
return {remove: () => {}}
}
},
}))
jest.mock('expo-file-system/legacy', () => ({
getInfoAsync: jest.fn().mockResolvedValue({exists: true, size: 100}),
deleteAsync: jest.fn(),
@@ -57,6 +87,24 @@ jest.mock('expo-media-library', () => ({
usePermissions: jest.fn(() => [true]),
}))
// the real module reads its constants off the native module at import time
jest.mock('expo-secure-store', () => {
const store = new Map()
return {
getItem: jest.fn(key => store.get(key) ?? null),
setItem: jest.fn((key, value) => {
store.set(key, value)
}),
AFTER_FIRST_UNLOCK: 0,
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: 1,
ALWAYS: 2,
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: 3,
ALWAYS_THIS_DEVICE_ONLY: 4,
WHEN_UNLOCKED: 5,
WHEN_UNLOCKED_THIS_DEVICE_ONLY: 6,
}
})
jest.mock('@bsky.app/expo-guess-language', () => ({
guessLanguageSync: jest
.fn()