Visitar URL original
Add compressionState to mock to avoid test failure (#290) · stuartmorgan-g/packages@4da6a9c · GitHub
Skip to content

Commit 4da6a9c

Browse files
authored
Add compressionState to mock to avoid test failure (flutter#290)
A recent change to the Dart SDK will throw an exception if a null value is passed to an exhaustive switch statement on a non-nullable enum type. (see dart-lang/sdk@2414b29) Add `compressionState` to mock so that the tests don't fail when the Dart changes are released. Related issue: flutter/flutter#66674
1 parent 62b83c7 commit 4da6a9c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎packages/flutter_markdown/test/utils.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ MockHttpClient createMockImageHttpClient(io.SecurityContext _) {
183183
.thenAnswer((_) => Future<io.HttpClientResponse>.value(response));
184184
when(response.contentLength).thenReturn(_transparentImage.length);
185185
when(response.statusCode).thenReturn(io.HttpStatus.ok);
186+
when(response.compressionState)
187+
.thenReturn(io.HttpClientResponseCompressionState.notCompressed);
186188
when(response.listen(any)).thenAnswer((Invocation invocation) {
187189
final void Function(List<int>) onData = invocation.positionalArguments[0];
188190
final void Function() onDone = invocation.namedArguments[#onDone];

0 commit comments

Comments
 (0)