31 lines
863 B
Dart
31 lines
863 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:prediqo_mobile/core/network/connectivity_controller.dart';
|
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
|
|
|
void main() {
|
|
test('onlineFromResults treats empty as offline', () {
|
|
expect(ConnectivityController.onlineFromResults(const []), isFalse);
|
|
});
|
|
|
|
test('onlineFromResults treats none as offline', () {
|
|
expect(
|
|
ConnectivityController.onlineFromResults(const [ConnectivityResult.none]),
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('onlineFromResults treats wifi/mobile as online', () {
|
|
expect(
|
|
ConnectivityController.onlineFromResults(const [ConnectivityResult.wifi]),
|
|
isTrue,
|
|
);
|
|
expect(
|
|
ConnectivityController.onlineFromResults(const [
|
|
ConnectivityResult.none,
|
|
ConnectivityResult.mobile,
|
|
]),
|
|
isTrue,
|
|
);
|
|
});
|
|
}
|