Skip to content

Commit

Permalink
autocomplete [nfc]: Pull prepareBoringImageHttpClient out to toplevel
Browse files Browse the repository at this point in the history
Moving `prepareBoringImageHttpClient` method to
the toplevel of the file will make it reusable in
other files.
  • Loading branch information
sm-sayedi committed Mar 26, 2024
1 parent ec07043 commit f3aebc9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/widgets/content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ import 'dialog_checks.dart';
import 'message_list_checks.dart';
import 'page_checks.dart';

/// Set [debugNetworkImageHttpClientProvider] to return a constant image.
///
/// Returns the [FakeImageHttpClient] that handles the requests.
///
/// The caller must set [debugNetworkImageHttpClientProvider] back to null
/// before the end of the test.
FakeImageHttpClient prepareBoringImageHttpClient() {
final httpClient = FakeImageHttpClient();
debugNetworkImageHttpClientProvider = () => httpClient;
httpClient.request.response
..statusCode = HttpStatus.ok
..content = kSolidBlueAvatar;
return httpClient;
}

void main() {
// For testing a new content feature:
//
Expand Down Expand Up @@ -64,21 +79,6 @@ void main() {
});
}

/// Set [debugNetworkImageHttpClientProvider] to return a constant image.
///
/// Returns the [FakeImageHttpClient] that handles the requests.
///
/// The caller must set [debugNetworkImageHttpClientProvider] back to null
/// before the end of the test.
FakeImageHttpClient prepareBoringImageHttpClient() {
final httpClient = FakeImageHttpClient();
debugNetworkImageHttpClientProvider = () => httpClient;
httpClient.request.response
..statusCode = HttpStatus.ok
..content = kSolidBlueAvatar;
return httpClient;
}

group('Heading', () {
testWidgets('plain h6', (tester) async {
await prepareContentBare(tester,
Expand Down

0 comments on commit f3aebc9

Please sign in to comment.