@@ -80,6 +80,7 @@ void main() {
8080 final cachedPref = await initMemCache.value (prefKey);
8181 expect (cachedPref, isNull);
8282 });
83+ <<<<<< < HEAD
8384 test ('ext ctor' , () async {
8485 final copy = Map <String , Map <String , dynamic >?>.of (data);
8586 final JsonCacheMem extMemCache = JsonCacheMem .ext (copy);
@@ -89,6 +90,17 @@ void main() {
8990 expect (cachedProf, isNull);
9091
9192 final cachedPref = await extMemCache.value (prefKey);
93+ ====== =
94+ test ('mem ctor' , () async {
95+ final copy = Map <String , Map <String , dynamic >?>.of (data);
96+ final JsonCacheMem memCache = JsonCacheMem .mem (copy);
97+ await memCache.clear ();
98+
99+ final cachedProf = await memCache.value (profKey);
100+ expect (cachedProf, isNull);
101+
102+ final cachedPref = await memCache.value (prefKey);
103+ >>>>>> > 32
92104 expect (cachedPref, isNull);
93105
94106 expect (copy.isEmpty, true );
@@ -110,6 +122,7 @@ void main() {
110122 final JsonCacheMem initMemCache = JsonCacheMem .init (data);
111123 await initMemCache.refresh (profKey, profData);
112124 await initMemCache.refresh (prefKey, prefData);
125+ <<<<<< < HEAD
113126
114127 await initMemCache.remove (profKey);
115128 final cachedProf = await initMemCache.value (profKey);
@@ -140,6 +153,38 @@ void main() {
140153 await memCache.refresh (profKey, profData);
141154 await memCache.refresh (prefKey, prefData);
142155
156+ ====== =
157+
158+ await initMemCache.remove (profKey);
159+ final cachedProf = await initMemCache.value (profKey);
160+ expect (cachedProf, isNull);
161+
162+ await initMemCache.remove (prefKey);
163+ final cachedPref = await initMemCache.value (prefKey);
164+ expect (cachedPref, isNull);
165+ });
166+ test ('mem ctor' , () async {
167+ final copy = Map <String , Map <String , dynamic >?>.of (data);
168+ final JsonCacheMem memCache = JsonCacheMem .mem (copy);
169+ await memCache.refresh (profKey, profData);
170+ await memCache.refresh (prefKey, prefData);
171+
172+ await memCache.remove (profKey);
173+ final cachedProf = await memCache.value (profKey);
174+ expect (cachedProf, isNull);
175+
176+ await memCache.remove (prefKey);
177+ final cachedPref = await memCache.value (prefKey);
178+ expect (cachedPref, isNull);
179+ });
180+ });
181+ group ('refresh and value' , () {
182+ test ('default ctor' , () async {
183+ final JsonCacheMem memCache = JsonCacheMem ();
184+ await memCache.refresh (profKey, profData);
185+ await memCache.refresh (prefKey, prefData);
186+
187+ >>>>>> > 32
143188 final cachedProf = await memCache.value (profKey);
144189 expect (cachedProf, profData);
145190
@@ -157,6 +202,7 @@ void main() {
157202 final cachedPref = await initMemCache.value (prefKey);
158203 expect (cachedPref, prefData);
159204 });
205+ <<<<<< < HEAD
160206 test ('ext ctor' , () async {
161207 final ext = < String , Map <String , dynamic >? > {};
162208 final JsonCacheMem extMemCache = JsonCacheMem .ext (ext);
@@ -170,6 +216,21 @@ void main() {
170216 expect (cachedPref, prefData);
171217 expect (ext[profKey], profData);
172218 expect (ext[prefKey], prefData);
219+ ====== =
220+ test ('mem ctor' , () async {
221+ final mem = < String , Map <String , dynamic >? > {};
222+ final JsonCacheMem memCache = JsonCacheMem .mem (mem);
223+ await memCache.refresh (profKey, profData);
224+ await memCache.refresh (prefKey, prefData);
225+
226+ final cachedProf = await memCache.value (profKey);
227+ expect (cachedProf, profData);
228+
229+ final cachedPref = await memCache.value (prefKey);
230+ expect (cachedPref, prefData);
231+ expect (mem[profKey], profData);
232+ expect (mem[prefKey], prefData);
233+ >>>>>> > 32
173234 });
174235 });
175236 });
0 commit comments