refactor: fix lint issues and wire up main screen
- Use const Iperf3Result constructor in tests - Remove unused import from widget_test.dart - Fix unnecessary underscore warnings in Consumer builders - Use initializing formal for iperf3Service field - Wire up main.dart to call Iperf3BinaryPathProvider.initialize()
This commit is contained in:
@@ -36,7 +36,7 @@ void main() {
|
||||
final mock = _MockIperf3Service(
|
||||
onRun: (config) async {
|
||||
expect(config.server, equals('192.168.1.1'));
|
||||
return Iperf3Result(rawOutput: 'done', exitCode: 0);
|
||||
return const Iperf3Result(rawOutput: 'done', exitCode: 0);
|
||||
},
|
||||
);
|
||||
final vm = TestRunViewModel(iperf3Service: mock);
|
||||
@@ -56,6 +56,6 @@ class _MockIperf3Service implements Iperf3Service {
|
||||
@override
|
||||
Future<Iperf3Result> run(TestConfiguration config) async {
|
||||
if (onRun != null) return onRun!(config);
|
||||
return Iperf3Result(rawOutput: '', exitCode: 0);
|
||||
return const Iperf3Result(rawOutput: '', exitCode: 0);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-17
@@ -5,26 +5,13 @@
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:iperf3_gui/main.dart';
|
||||
import 'package:iperf3gui/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
testWidgets('App smoke test', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(const Iperf3GuiApp());
|
||||
expect(find.text('iperf3-gui'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user