You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug removeItems function does not remove anything from store and returns undefined instead of boolean.
To Reproduce
create a test file
add below content and run the tests
import{isLoaded}from'react-native-mmkv-storage';describe('bug repro test',()=>{//from docsbeforeEach(()=>{// Install the in-memory adapterletmmkvMock=require('react-native-mmkv-storage/jest/dist/jest/memoryStore.js');mmkvMock.unmock();// Cleanup if already mockedmmkvMock.mock();// Mock the storage});//from docs: Use the storage methods as needed. Everything is mocked nowit('Mock bindings are installed',()=>{expect(isLoaded()).toBe(true);});//my own testit('testing removeItems function',()=>{conststorage=newMMKVLoader().setProcessingMode(ProcessingModes.SINGLE_PROCESS).withInstanceID('instance').initialize();// Store some itemsstorage.setString('key1','value1');storage.setString('key2','value2');storage.setString('key3','value3');// Array with multiple keysconstkeysToRemove=['key1','key2'];storage.removeItems(keysToRemove);//does not remove the 2 given keysconstitem1=storage.getString('key1');constitem2=storage.getString('key2');constitem3=storage.getString('key3');expect(item1).toBeNull();// Should be null but its notexpect(item2).toBeNull();// Should be null but its notexpect(item3).toBe('value3');// Should still be 'value3'});});
Expected behavior
items with keys key1 and key2 should be removed from store but they don't. In other words, this test should pass.
Screenshots
not necessary
Platform Information:
OS: it's happening in testing with jest. I didn't test it at runtime yet.
React Native Version: 0.76.7
Library Version ^0.11.2
Additional context
I rewrote my actual code to iterate over keys array and remove them one by one for now. It passes the test that way:)
Let me know if there is anything else you need to know.
The text was updated successfully, but these errors were encountered:
Describe the bug
removeItems
function does not remove anything from store and returns undefined instead of boolean.To Reproduce
Expected behavior
items with keys
key1
andkey2
should be removed from store but they don't. In other words, this test should pass.Screenshots
not necessary
Platform Information:
0.76.7
^0.11.2
Additional context
I rewrote my actual code to iterate over keys array and remove them one by one for now. It passes the test that way:)
Let me know if there is anything else you need to know.
The text was updated successfully, but these errors were encountered: