TF-2536 Write unit test for getAllMailbox method repository

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2024-02-06 14:41:03 +07:00
committed by Dat PHAM HOANG
parent 16f362a61a
commit eb3e22b467
14 changed files with 291 additions and 127 deletions
@@ -188,9 +188,9 @@ abstract class HiveCacheClient<T> {
Future<void> clearAllDataContainKey(String nestedKey) {
return Future.sync(() async {
final boxItem = encryption ? await openBoxEncryption() : await openBox();
final mapItemNotContainNestedKey = boxItem.toMap().where((key, value) => !_matchedNestedKey(key, nestedKey));
log('HiveCacheClient::clearAllDataContainKey:mapItemNotContainNestedKey: ${mapItemNotContainNestedKey.length}');
return boxItem.putAll(mapItemNotContainNestedKey);
final listKeys = boxItem.toMap().where((key, value) => _matchedNestedKey(key, nestedKey)).keys;
log('HiveCacheClient::clearAllDataContainKey:listKeys: ${listKeys.length}');
return boxItem.deleteAll(listKeys);
}).catchError((error) {
throw error;
});