-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathremove_keys_test.dart
45 lines (44 loc) · 1.01 KB
/
remove_keys_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:ms_map_utils/ms_map_utils.dart';
import 'package:test/test.dart';
void main() {
test('Remove all entries that has a key in list', () {
// ignore: omit_local_variable_types
Map mapNumbers = {
'key1': 1,
'key2': 2,
'key3': 3,
'key4': 4,
'key5': 5,
'map': {
'key1': 1,
'key2': 2,
'key3': 3,
'key4': 4,
'key5': 5,
}
};
mapNumbers.removeKeys(['key1', 'key2']);
expect(mapNumbers.length, 4);
expect(mapNumbers['map'].length, 5);
});
test('Remove all entries that has a key in list with recursive', () {
// ignore: omit_local_variable_types
Map mapNumbers = {
'key1': 1,
'key2': 2,
'key3': 3,
'key4': 4,
'key5': 5,
'map': {
'key1': 1,
'key2': 2,
'key3': 3,
'key4': 4,
'key5': 5,
}
};
mapNumbers.removeKeys(['key1', 'key2'], true);
expect(mapNumbers.length, 4);
expect(mapNumbers['map'].length, 3);
});
}