From f3aebc9fdc0f081d64f681fbcd54fa93f99d76d3 Mon Sep 17 00:00:00 2001 From: Sayed Mahmood Sayedi Date: Wed, 27 Mar 2024 01:11:03 +0430 Subject: [PATCH] autocomplete [nfc]: Pull `prepareBoringImageHttpClient` out to toplevel Moving `prepareBoringImageHttpClient` method to the toplevel of the file will make it reusable in other files. --- test/widgets/content_test.dart | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/widgets/content_test.dart b/test/widgets/content_test.dart index 00a7a1cfba9..a6bf6b61d25 100644 --- a/test/widgets/content_test.dart +++ b/test/widgets/content_test.dart @@ -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: // @@ -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,