Skip to content

Commit 94cc948

Browse files
committed
Update dependencies
1 parent e6ffbf1 commit 94cc948

File tree

3 files changed

+52
-61
lines changed

3 files changed

+52
-61
lines changed

pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ version: 3.0.0-nullsafety
77
dependencies:
88
flutter:
99
sdk: flutter
10-
flutter_cache_manager: ^3.0.0-nullsafety
11-
octo_image: ^1.0.0-nullsafety
10+
flutter_cache_manager: ^3.0.0
11+
octo_image: ^1.0.0
1212

1313
dev_dependencies:
1414
flutter_test:
1515
sdk: flutter
16-
mocktail: ^0.0.1-0
17-
pedantic: ^1.10.0
16+
mocktail: ^0.1.1
17+
pedantic: ^1.11.0
1818
file: ^6.1.0
1919

2020
environment:

test/fake_cache_manager.dart

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ import 'dart:async';
1111

1212
class FakeCacheManager extends Mock implements CacheManager {
1313
void throwsNotFound(String url) {
14-
when(this).calls(#getFileStream).withArgs(
15-
positional: [url],
16-
named: {
17-
#key: any,
18-
#headers: any,
19-
#withProgress: any,
20-
},
21-
).thenThrow(HttpExceptionWithStatus(404, 'Invalid statusCode: 404',
22-
uri: Uri.parse(url)));
14+
when(() => getFileStream(
15+
url,
16+
key: any(named: 'key'),
17+
headers: any(named: 'headers'),
18+
withProgress: any(named: 'withProgress'),
19+
))
20+
.thenThrow(HttpExceptionWithStatus(404, 'Invalid statusCode: 404',
21+
uri: Uri.parse(url)));
2322
}
2423

2524
ExpectedData returns(
@@ -33,14 +32,12 @@ class FakeCacheManager extends Mock implements CacheManager {
3332
Uint8List.fromList(imageData.skip(offset).take(chunkSize).toList()),
3433
];
3534

36-
when(this).calls(#getFileStream).withArgs(
37-
positional: [url],
38-
named: {
39-
#key: any,
40-
#headers: any,
41-
#withProgress: any,
42-
},
43-
).thenAnswer((_) => _createResultStream(
35+
when(() => getFileStream(
36+
url,
37+
key: any(named: 'key'),
38+
headers: any(named: 'headers'),
39+
withProgress: any(named: 'withProgress'),
40+
)).thenAnswer((_) => _createResultStream(
4441
url,
4542
chunks,
4643
imageData,
@@ -88,16 +85,14 @@ class FakeImageCacheManager extends Mock implements ImageCacheManager {
8885
Uint8List.fromList(imageData.skip(offset).take(chunkSize).toList()),
8986
];
9087

91-
when(this).calls(#getImageFile).withArgs(
92-
positional: [url],
93-
named: {
94-
#key: any,
95-
#headers: any,
96-
#withProgress: any,
97-
#maxHeight: any,
98-
#maxWidth: any,
99-
},
100-
).thenAnswer((_) => _createResultStream(
88+
when(() => getImageFile(
89+
url,
90+
key: any(named: 'key'),
91+
headers: any(named: 'headers'),
92+
withProgress: any(named: 'withProgress'),
93+
maxHeight: any(named: 'maxHeight'),
94+
maxWidth: any(named: 'maxWidth'),
95+
)).thenAnswer((_) => _createResultStream(
10196
url,
10297
chunks,
10398
imageData,
@@ -138,7 +133,9 @@ class ExpectedData {
138133
final int totalSize;
139134
final int chunkSize;
140135

141-
const ExpectedData({required this.chunks, required this.totalSize, required
142-
this
143-
.chunkSize,});
136+
const ExpectedData({
137+
required this.chunks,
138+
required this.totalSize,
139+
required this.chunkSize,
140+
});
144141
}

test/image_cache_manager_test.dart

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,21 @@ void main() {
4545
));
4646
await imageAvailable.future;
4747

48-
verify(cacheManager).called(#getImageFile).withArgs(
49-
positional: [url],
50-
named: {
51-
#key: any,
52-
#headers: any,
53-
#withProgress: any,
54-
#maxHeight: any,
55-
#maxWidth: any,
56-
},
57-
).times(1);
58-
59-
verify(cacheManager).called(#getFileStream).withArgs(
60-
positional: [url],
61-
named: {
62-
#key: any,
63-
#headers: any,
64-
#withProgress: any,
65-
},
66-
).never();
48+
verify(() => cacheManager.getImageFile(
49+
url,
50+
key: any(named: 'key'),
51+
headers: any(named: 'headers'),
52+
withProgress: any(named: 'withProgress'),
53+
maxHeight: any(named: 'maxHeight'),
54+
maxWidth: any(named: 'maxWidth'),
55+
)).called(1);
56+
57+
verifyNever(() => cacheManager.getFileStream(
58+
url,
59+
key: any(named: 'key'),
60+
headers: any(named: 'headers'),
61+
withProgress: any(named: 'withProgress'),
62+
));
6763
}, skip: isBrowser);
6864

6965
test('Supplying an CacheManager should call getFileStream', () async {
@@ -84,14 +80,12 @@ void main() {
8480
));
8581
await imageAvailable.future;
8682

87-
verify(cacheManager).called(#getFileStream).withArgs(
88-
positional: [url],
89-
named: {
90-
#key: any,
91-
#headers: any,
92-
#withProgress: any,
93-
},
94-
).times(1);
83+
verify(() => cacheManager.getFileStream(
84+
url,
85+
key: any(named: 'key'),
86+
headers: any(named: 'headers'),
87+
withProgress: any(named: 'withProgress'),
88+
)).called(1);
9589
}, skip: isBrowser);
9690

9791
test('Supplying an CacheManager with maxHeight throws assertion', () async {

0 commit comments

Comments
 (0)