diff --git a/geolocator_web/CHANGELOG.md b/geolocator_web/CHANGELOG.md index 53ff43db..997d472d 100644 --- a/geolocator_web/CHANGELOG.md +++ b/geolocator_web/CHANGELOG.md @@ -1,6 +1,6 @@ ## 2.2.1 -- Migrate tests to support sound null safety. +- Migrates tests to support sound null safety. ## 2.2.0 diff --git a/geolocator_web/pubspec.yaml b/geolocator_web/pubspec.yaml index 7d4e8682..4ca91611 100644 --- a/geolocator_web/pubspec.yaml +++ b/geolocator_web/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: geolocator_platform_interface: ^4.1.0 dev_dependencies: + build_runner: ^2.4.8 flutter_test: sdk: flutter flutter_lints: ^3.0.1 diff --git a/geolocator_web/test/geolocator_utils_test.mocks.dart b/geolocator_web/test/geolocator_utils_test.mocks.dart index 317cbab8..bee53604 100644 --- a/geolocator_web/test/geolocator_utils_test.mocks.dart +++ b/geolocator_web/test/geolocator_utils_test.mocks.dart @@ -1,5 +1,5 @@ -// Mocks generated by Mockito 5.4.1-wip from annotations -// in geolocator.web/test/geolocator_utils_test.dart. +// Mocks generated by Mockito 5.4.4 from annotations +// in geolocator_web/test/geolocator_utils_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes diff --git a/geolocator_web/test/geolocator_web_test.dart b/geolocator_web/test/geolocator_web_test.dart index 34e1231c..1b71f0b4 100644 --- a/geolocator_web/test/geolocator_web_test.dart +++ b/geolocator_web/test/geolocator_web_test.dart @@ -53,14 +53,6 @@ void main() { }); group('Permission methods', () { - test('checkPermission throws exception when permissionsSupported is false', - () async { - when(mockPermissionsManager.permissionsSupported).thenReturn(false); - - expect( - geolocatorPlugin.checkPermission, throwsA(isA())); - }); - test('checkPermission returns the correct LocationPermission', () async { when(mockPermissionsManager.permissionsSupported).thenReturn(true); diff --git a/geolocator_web/test/geolocator_web_test.mocks.dart b/geolocator_web/test/geolocator_web_test.mocks.dart index 4fe3a08b..be0de5d1 100644 --- a/geolocator_web/test/geolocator_web_test.mocks.dart +++ b/geolocator_web/test/geolocator_web_test.mocks.dart @@ -1,15 +1,15 @@ -// Mocks generated by Mockito 5.4.1-wip from annotations -// in geolocator.web/test/geolocator_web_test.dart. +// Mocks generated by Mockito 5.4.4 from annotations +// in geolocator_web/test/geolocator_web_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'package:mockito/mockito.dart' as _i1; import 'package:geolocator_platform_interface/geolocator_platform_interface.dart' as _i2; import 'package:geolocator_web/src/geolocation_manager.dart' as _i3; import 'package:geolocator_web/src/permissions_manager.dart' as _i5; +import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -39,10 +39,6 @@ class _FakePosition_0 extends _i1.SmartFake implements _i2.Position { /// See the documentation for Mockito's code generation for more information. class MockGeolocationManager extends _i1.Mock implements _i3.GeolocationManager { - MockGeolocationManager() { - _i1.throwOnMissingStub(this); - } - @override _i4.Future<_i2.Position> getCurrentPosition({ bool? enableHighAccuracy, @@ -68,6 +64,18 @@ class MockGeolocationManager extends _i1.Mock }, ), )), + returnValueForMissingStub: + _i4.Future<_i2.Position>.value(_FakePosition_0( + this, + Invocation.method( + #getCurrentPosition, + [], + { + #enableHighAccuracy: enableHighAccuracy, + #timeout: timeout, + }, + ), + )), ) as _i4.Future<_i2.Position>); @override @@ -85,6 +93,7 @@ class MockGeolocationManager extends _i1.Mock }, ), returnValue: _i4.Stream<_i2.Position>.empty(), + returnValueForMissingStub: _i4.Stream<_i2.Position>.empty(), ) as _i4.Stream<_i2.Position>); } @@ -93,14 +102,11 @@ class MockGeolocationManager extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockPermissionsManager extends _i1.Mock implements _i5.PermissionsManager { - MockPermissionsManager() { - _i1.throwOnMissingStub(this); - } - @override bool get permissionsSupported => (super.noSuchMethod( Invocation.getter(#permissionsSupported), returnValue: false, + returnValueForMissingStub: false, ) as bool); @override @@ -112,5 +118,7 @@ class MockPermissionsManager extends _i1.Mock ), returnValue: _i4.Future<_i2.LocationPermission>.value( _i2.LocationPermission.denied), + returnValueForMissingStub: _i4.Future<_i2.LocationPermission>.value( + _i2.LocationPermission.denied), ) as _i4.Future<_i2.LocationPermission>); }