Replies: 2 comments
|
Still relevant. |
0 replies
|
This was a real pain point in older versions, but the current package is much better here. In v3, the shipped Jest mock is fully typed and implements the // jest.setup.ts
jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest')
)And if you want to isolate tests: import { clearAllMockStorages } from '@react-native-async-storage/async-storage/jest'
afterEach(() => {
clearAllMockStorages()
})If you're still on v2, then yes, the mock typings can lag behind the real interface. In that case the cleanest fix is either:
So I would treat this as version-specific: older mock typings were incomplete, but current versions have largely fixed that problem. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
According to TypeScript typing, it looks like the Jest mock implementation delivered by this package is incomplete.
Using the following code (similar to the example in the docs):
This results in the following error:

Error log.
The work-around is to remove the typed mock, but I prefer not to do that:
I tried also to use
Partial, but that gave a similar error:Does this count as a bug?
All reactions