Skip to content

Commit 94050b2

Browse files
matthamilKrzysztof Borowy
authored and
Krzysztof Borowy
committed
fix: Jest mock getAllKeys to return array of keys
1 parent 0005ad7 commit 94050b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jest/async-storage-mock.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const asMock = {
4040
),
4141

4242
clear: jest.fn<[CallbackType], Promise<*>>(_clear),
43-
getAllKeys: jest.fn<[], void>(),
43+
getAllKeys: jest.fn<[], Promise<string[]>>(_getAllKeys),
4444
flushGetRequests: jest.fn<[], void>(),
4545

4646
multiGet: jest.fn<[KeysType, ResultCallbackType], Promise<*>>(_multiGet),
@@ -89,6 +89,10 @@ async function _clear(callback: CallbackType) {
8989
return null;
9090
}
9191

92+
async function _getAllKeys() {
93+
return Object.keys(asMock.__INTERNAL_MOCK_STORAGE__);
94+
}
95+
9296
async function _multiMerge(
9397
keyValuePairs: KeyValueType,
9498
callback: CallbackType,

0 commit comments

Comments
 (0)