ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.59k stars 111 forks source link

[Bug] jest mock returns null when falsy values are stored #360

Open shrouxm opened 2 weeks ago

shrouxm commented 2 weeks ago

Describe the bug When using the jest mock, if you store falsy values and then retrieve them from the store you will get null back.

For example, in a test file:

mmkv.setBool('key', false);
mmkv.getBool('key'); // returns null

mmkv.setString('key', '');
mmkv.getString(''); // returns null

Expected behavior Should return the falsy value instead of null

Additional context I think this PR intended to fix the issue, but it updates the .ts file without updating the .js file in the dist folder so users are still running code with the bug.

I'm not sure how to generate a new dist folder so hoping that will be an easy step for maintainers!