File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,11 @@ RNSecureKeyStore.remove("key1")
76
76
```
77
77
- For demo app, checkout example directory.
78
78
79
+ ## Testing
80
+
81
+ For Testing using Jest, add RNSecureKeyStoreMock implementation under your __ test__ /__ mocks__ folder.
82
+ This mock implementation makes easy for you to make testing that dependes on react-native-secure-key-store
83
+
79
84
## License
80
85
81
86
ISC License (ISC)
Original file line number Diff line number Diff line change
1
+ class RNSecureKeyStoreMock {
2
+ store;
3
+
4
+ constructor() {
5
+ this.store = new Map();
6
+ }
7
+
8
+ get(k) {
9
+ const result = this.store.get(k);
10
+ return Promise.resolve(result);
11
+ }
12
+
13
+ remove(k) {
14
+ this.store.delete(k);
15
+ return Promise.resolve(true);
16
+ }
17
+
18
+ set(k, value) {
19
+ console.log('set', k, value);
20
+
21
+ this.store.set(k, value);
22
+ return Promise.resolve(true);
23
+ }
24
+ }
25
+
26
+ const RNSecureKeyStore = new RNSecureKeyStoreMock();
27
+
28
+ export default RNSecureKeyStore;
You can’t perform that action at this time.
0 commit comments