Collapse duplicated setup across the suite into six shared helpers under test/test_helpers/ and rewrite the 28 suites that were open-coding it: http_fixtures.dart jsonResponse() for http.Response JSON stubs library_tab_scaffold.dart pumps library tabs under their required ancestors multi_server_fixtures.dart MultiServerProvider wiring for widget tests playback_report_fakes.dart PlaybackReportCall + fake report sinks profile_stack.dart production-shaped profile dependency graph theme.dart testMonoTokens for fast-settling widget tests Net -1245 lines with no change in coverage or assertions.
8 lines
305 B
Dart
8 lines
305 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
/// JSON-encodes [body] into an [http.Response] carrying a JSON content type.
|
|
http.Response jsonResponse(Object body, {int status = 200}) =>
|
|
http.Response(jsonEncode(body), status, headers: const {'content-type': 'application/json'});
|