Background
Expo is the officially recommended framework for React Native, which can significantly enhance the development efficiency of apps.
expo-sqlite is the official plugin of Expo, supporting the use of Sqlite in the app.
By using expo-sqlite, it is easy to overcome the limitations of built-in storage space on various platforms, allowing for the persistent storage of more data on mobile devices.
However, expo-sqlite cannot run in the testing environment and can only run in end-to-end tests.
So I created expo-sqlite-mock to facilitate unit testing based on Jest.
How to Use
- Install dependencies:
npm install -D expo-sqlite-mock
orbun add -D expo-sqlite-mock
. - Add jest configuration (usually in package.json)
"setupFilesAfterEnv": ["expo-sqlite-mock/src/setup.ts"]
and"testTimeout": 10000
.