Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage is restricted by vm #51

Merged
merged 4 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/host_scan_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ void main() {
// Fetching interfaceIp and hostIp
setUpAll(() async {
HttpOverrides.global = FakeResponseHttpOverrides();
await configureNetworkToolsFlutter('build');
// Use implementation classes to call methods to increase coverage
await configureNetworkToolsFlutter('build', enableDebugging: true);
hostScannerService =
HostScannerService.instance as HostScannerServiceFlutterImpl;

Expand All @@ -36,13 +35,18 @@ void main() {
// Better to restrict to scan from hostId - 1 to hostId + 1 to prevent GHA timeouts
firstHostId = hostId <= 1 ? hostId : hostId - 1;
lastHostId = hostId >= 254 ? hostId : hostId + 1;
logger.fine("First hostId : $firstHostId and last hostId : $lastHostId");
logger.fine(
'Fetched own host as $myOwnHost and interface address as $interfaceIp',
);
}
});

group('Testing Host Scanner emits', () {
test('Check if flutter implementations are injected', () {
expect(
HostScannerService.instance is HostScannerServiceFlutterImpl, true);
});
test('Running getAllPingableDevices emits tests', () async* {
expectLater(
//There should be at least one device pingable in network
Expand Down
6 changes: 5 additions & 1 deletion test/port_scan_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:async';

import 'package:flutter_test/flutter_test.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';
import 'package:network_tools_flutter/src/services_impls/port_scanner_service_flutter_impl.dart';
import 'fake_http_overrides.dart';
import 'package:universal_io/io.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -35,6 +35,10 @@ void main() {
});

group('Testing Port Scanner', () {
test('Check if flutter implementations are injected', () {
expect(
PortScannerService.instance is PortScannerServiceFlutterImpl, true);
});
test('Running scanPortsForSingleDevice tests', () {
for (final activeHost in hostsWithOpenPort) {
final port = activeHost.openPorts.elementAt(0).port;
Expand Down
Loading