Skip to content

Commit

Permalink
invoker error fix
Browse files Browse the repository at this point in the history
git-elliot committed Mar 31, 2024
1 parent 9e453d1 commit 1881e9a
Showing 3 changed files with 14 additions and 15 deletions.
14 changes: 7 additions & 7 deletions test/host_scan_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -5,24 +5,24 @@ import 'package:network_tools_flutter/src/services_impls/host_scanner_service_fl
import 'fake_http_overrides.dart';
import 'package:universal_io/io.dart';

Future<void> main() async {
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
int port = 0;
int firstHostId = 0;
int lastHostId = 0;
int hostId = 0;
String myOwnHost = "0.0.0.0";
String interfaceIp = myOwnHost.substring(0, myOwnHost.lastIndexOf('.'));

await configureNetworkToolsFlutter('build');
// Use implementation classes to call methods to increase coverage
HostScannerServiceFlutterImpl hostScannerService =
HostScannerService.instance as HostScannerServiceFlutterImpl;

late HostScannerServiceFlutterImpl hostScannerService;
late ServerSocket server;
// Fetching interfaceIp and hostIp
setUpAll(() async {
HttpOverrides.global = FakeResponseHttpOverrides();
await configureNetworkToolsFlutter('build');
// Use implementation classes to call methods to increase coverage
hostScannerService =
HostScannerService.instance as HostScannerServiceFlutterImpl;

//open a port in shared way because of portscanner using same,
//if passed false then two hosts come up in search and breaks test.
server =
2 changes: 1 addition & 1 deletion test/network_tools_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';

Future<void> main() async {
void main() {
test('adds one to input values', () async {});
}
13 changes: 6 additions & 7 deletions test/port_scan_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -6,20 +6,19 @@ import 'fake_http_overrides.dart';
import 'package:universal_io/io.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';

Future<void> main() async {
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
int port = 0; // keep this value between 1-2034
final List<ActiveHost> hostsWithOpenPort = [];
late ServerSocket server;

await configureNetworkToolsFlutter('build');
// Use implementation classes to call methods to increase coverage
PortScannerServiceFlutterImpl portScannerService =
PortScannerService.instance as PortScannerServiceFlutterImpl;

late PortScannerServiceFlutterImpl portScannerService;
// Fetching interfaceIp and hostIp
setUpAll(() async {
HttpOverrides.global = FakeResponseHttpOverrides();
await configureNetworkToolsFlutter('build');
// Use implementation classes to call methods to increase coverage
portScannerService =
PortScannerService.instance as PortScannerServiceFlutterImpl;

//open a port in shared way because of HostScannerService.instance using same,
//if passed false then two hosts come up in search and breaks test.

0 comments on commit 1881e9a

Please sign in to comment.