diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml index c700ac282f..78099227d5 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/pubspec.yaml @@ -36,4 +36,4 @@ dev_dependencies: built_value_generator: 8.8.1 flutter_test: sdk: flutter - mockito: ^5.0.0 + mocktail: ^1.0.0 diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.dart b/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.dart index 85af25b503..f5384def1e 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.dart +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.dart @@ -8,22 +8,24 @@ import 'package:amplify_analytics_pinpoint_dart/src/impl/analytics_client/event_ import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:amplify_push_notifications_pinpoint/src/pinpoint_provider.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; -import 'pinpoint_provider_test.mocks.dart'; import 'test_data/fake_notification_messges.dart'; -@GenerateMocks( - [ - AmplifyAuthProviderRepository, - AWSIamAmplifyAuthProvider, - UserProfile, - AnalyticsClient, - EndpointClient, - EventClient, - ], -) +class MockAmplifyAuthProviderRepository extends Mock + implements AmplifyAuthProviderRepository {} + +class MockAWSIamAmplifyAuthProvider extends Mock + implements AWSIamAmplifyAuthProvider {} + +class MockUserProfile extends Mock implements UserProfile {} + +class MockAnalyticsClient extends Mock implements AnalyticsClient {} + +class MockEndpointClient extends Mock implements EndpointClient {} + +class MockEventClient extends Mock implements EventClient {} + void main() { TestWidgetsFlutterBinding.ensureInitialized(); final pinpointProvider = PinpointProvider(); @@ -35,9 +37,24 @@ void main() { final awsIamAmplifyAuthProvider = MockAWSIamAmplifyAuthProvider(); final mockAnalyticsClient = MockAnalyticsClient(); group('PinpointProvider', () { + setUpAll(() { + registerFallbackValue( + const AmplifyAuthProviderToken('mock-token'), + ); + registerFallbackValue( + const AWSCredentialsProvider( + AWSCredentials( + 'accessKeyId', + 'secretAccessKey', + ), + ), + ); + }); test('init fails when retrieving an Auth provider was not successful', () { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(null); + when( + () => mockAmplifyAuthProviderRepository + .getAuthProvider(any()), + ).thenReturn(null); expect( () async => pinpointProvider.init( config: notificationsPinpointConfig, @@ -72,20 +89,23 @@ void main() { test('identifyUser should throw exception if the underlying call throws', () async { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(awsIamAmplifyAuthProvider); when( - mockAnalyticsClient.init( - pinpointAppId: anyNamed('pinpointAppId'), - region: anyNamed('region'), - authProvider: anyNamed('authProvider'), + () => mockAmplifyAuthProviderRepository.getAuthProvider( + APIAuthorizationType.iam.authProviderToken, + ), + ).thenReturn(awsIamAmplifyAuthProvider); + when( + () => mockAnalyticsClient.init( + pinpointAppId: any(named: 'pinpointAppId'), + region: any(named: 'region'), + authProvider: any(named: 'authProvider'), ), ).thenAnswer((realInvocation) async {}); final mockEndpointClient = MockEndpointClient(); when( - mockAnalyticsClient.endpointClient, + () => mockAnalyticsClient.endpointClient, ).thenReturn(mockEndpointClient); await pinpointProvider.init( @@ -93,7 +113,8 @@ void main() { authProviderRepo: mockAmplifyAuthProviderRepository, analyticsClient: mockAnalyticsClient, ); - when(mockEndpointClient.setUser(any, any)).thenThrow(Exception()); + when(() => mockEndpointClient.setUser(any(), any())) + .thenThrow(Exception()); expect( pinpointProvider.identifyUser( userId: 'userId', @@ -135,16 +156,32 @@ void main() { }); group('Happy path test', () { + setUpAll(() { + registerFallbackValue( + const AmplifyAuthProviderToken('mock-token'), + ); + registerFallbackValue( + const AWSCredentialsProvider( + AWSCredentials( + 'accessKeyId', + 'secretAccessKey', + ), + ), + ); + }); TestWidgetsFlutterBinding.ensureInitialized(); test('init should run successfully', () async { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(awsIamAmplifyAuthProvider); when( - mockAnalyticsClient.init( - pinpointAppId: anyNamed('pinpointAppId'), - region: anyNamed('region'), - authProvider: anyNamed('authProvider'), + () => mockAmplifyAuthProviderRepository.getAuthProvider( + APIAuthorizationType.iam.authProviderToken, + ), + ).thenReturn(awsIamAmplifyAuthProvider); + when( + () => mockAnalyticsClient.init( + pinpointAppId: any(named: 'pinpointAppId'), + region: any(named: 'region'), + authProvider: any(named: 'authProvider'), ), ).thenAnswer((realInvocation) async {}); expect( @@ -158,20 +195,26 @@ void main() { }); test('identifyUser should run successfully', () async { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(awsIamAmplifyAuthProvider); when( - mockAnalyticsClient.init( - pinpointAppId: anyNamed('pinpointAppId'), - region: anyNamed('region'), - authProvider: anyNamed('authProvider'), + () => mockAmplifyAuthProviderRepository.getAuthProvider( + APIAuthorizationType.iam.authProviderToken, + ), + ).thenReturn(awsIamAmplifyAuthProvider); + when( + () => mockAnalyticsClient.init( + pinpointAppId: any(named: 'pinpointAppId'), + region: any(named: 'region'), + authProvider: any(named: 'authProvider'), ), ).thenAnswer((realInvocation) async {}); final mockEndpointClient = MockEndpointClient(); + when(() => mockEndpointClient.setUser(any(), any())) + .thenAnswer((_) async => {}); + when(mockEndpointClient.updateEndpoint).thenAnswer((_) async => {}); when( - mockAnalyticsClient.endpointClient, + () => mockAnalyticsClient.endpointClient, ).thenReturn(mockEndpointClient); await pinpointProvider.init( @@ -187,27 +230,33 @@ void main() { ), completes, ); - verify(mockEndpointClient.setUser(any, any)); + verify(() => mockEndpointClient.setUser(any(), any())); }); test('registerDevice should run successfully', () async { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(awsIamAmplifyAuthProvider); when( - mockAnalyticsClient.init( - pinpointAppId: anyNamed('pinpointAppId'), - region: anyNamed('region'), - authProvider: anyNamed('authProvider'), + () => mockAmplifyAuthProviderRepository.getAuthProvider( + APIAuthorizationType.iam.authProviderToken, + ), + ).thenReturn(awsIamAmplifyAuthProvider); + when( + () => mockAnalyticsClient.init( + pinpointAppId: any(named: 'pinpointAppId'), + region: any(named: 'region'), + authProvider: any(named: 'authProvider'), ), ).thenAnswer((realInvocation) async {}); final mockEndpointClient = MockEndpointClient(); + when(() => mockEndpointClient.setUser(any(), any())) + .thenAnswer((_) async => {}); + when(mockEndpointClient.updateEndpoint).thenAnswer((_) async => {}); when( - mockAnalyticsClient.endpointClient, + () => mockAnalyticsClient.endpointClient, ).thenReturn(mockEndpointClient); - expect( + await expectLater( pinpointProvider.init( config: notificationsPinpointConfig, authProviderRepo: mockAmplifyAuthProviderRepository, @@ -222,27 +271,37 @@ void main() { ), completes, ); - verify(mockEndpointClient.updateEndpoint()); + verify(mockEndpointClient.updateEndpoint); }); test('recordEvent should run successfully', () async { - when(mockAmplifyAuthProviderRepository.getAuthProvider(any)) - .thenReturn(awsIamAmplifyAuthProvider); when( - mockAnalyticsClient.init( - pinpointAppId: anyNamed('pinpointAppId'), - region: anyNamed('region'), - authProvider: anyNamed('authProvider'), + () => mockAmplifyAuthProviderRepository.getAuthProvider( + APIAuthorizationType.iam.authProviderToken, + ), + ).thenReturn(awsIamAmplifyAuthProvider); + when( + () => mockAnalyticsClient.init( + pinpointAppId: any(named: 'pinpointAppId'), + region: any(named: 'region'), + authProvider: any(named: 'authProvider'), ), ).thenAnswer((realInvocation) async {}); final mockEventClient = MockEventClient(); + when( + () => mockEventClient.recordEvent( + eventType: any(named: 'eventType'), + session: any(named: 'session'), + properties: any(named: 'properties'), + ), + ).thenAnswer((_) async => {}); when( - mockAnalyticsClient.eventClient, + () => mockAnalyticsClient.eventClient, ).thenReturn(mockEventClient); - expect( + await expectLater( pinpointProvider.init( config: notificationsPinpointConfig, authProviderRepo: mockAmplifyAuthProviderRepository, @@ -251,7 +310,7 @@ void main() { completes, ); - expect( + await expectLater( pinpointProvider.recordNotificationEvent( eventType: PinpointEventType.foregroundMessageReceived, notification: @@ -260,10 +319,10 @@ void main() { completes, ); verify( - mockEventClient.recordEvent( + () => mockEventClient.recordEvent( eventType: '${PinpointEventSource.campaign.name}.${PinpointEventType.foregroundMessageReceived.name}', - properties: anyNamed('properties'), + properties: any(named: 'properties'), ), ); }); diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.mocks.dart b/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.mocks.dart deleted file mode 100644 index 1b0f6bad61..0000000000 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/test/pinpoint_provider_test.mocks.dart +++ /dev/null @@ -1,430 +0,0 @@ -// Mocks generated by Mockito 5.4.1 from annotations -// in amplify_push_notifications_pinpoint/test/pinpoint_provider_test.dart. -// Do not manually edit this file. - -// @dart=2.19 - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i7; - -import 'package:amplify_analytics_pinpoint_dart/src/impl/analytics_client/analytics_client.dart' - as _i8; -import 'package:amplify_analytics_pinpoint_dart/src/impl/analytics_client/endpoint_client/endpoint_client.dart' - as _i4; -import 'package:amplify_analytics_pinpoint_dart/src/impl/analytics_client/event_client/event_client.dart' - as _i5; -import 'package:amplify_analytics_pinpoint_dart/src/impl/analytics_client/event_client/queued_item_store/queued_item_store.dart' - as _i9; -import 'package:amplify_analytics_pinpoint_dart/src/sdk/pinpoint.dart' as _i6; -import 'package:amplify_core/amplify_core.dart' as _i3; -import 'package:aws_signature_v4/aws_signature_v4.dart' as _i2; -import 'package:mockito/mockito.dart' as _i1; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeAWSSignedRequest_0 extends _i1.SmartFake - implements _i2.AWSSignedRequest { - _FakeAWSSignedRequest_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAWSCredentials_1 extends _i1.SmartFake - implements _i3.AWSCredentials { - _FakeAWSCredentials_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeEndpointClient_2 extends _i1.SmartFake - implements _i4.EndpointClient { - _FakeEndpointClient_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeEventClient_3 extends _i1.SmartFake implements _i5.EventClient { - _FakeEventClient_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePublicEndpoint_4 extends _i1.SmartFake - implements _i6.PublicEndpoint { - _FakePublicEndpoint_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [AmplifyAuthProviderRepository]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAmplifyAuthProviderRepository extends _i1.Mock - implements _i3.AmplifyAuthProviderRepository { - MockAmplifyAuthProviderRepository() { - _i1.throwOnMissingStub(this); - } - - @override - T? getAuthProvider( - _i3.AmplifyAuthProviderToken? token) => - (super.noSuchMethod(Invocation.method( - #getAuthProvider, - [token], - )) as T?); - @override - void registerAuthProvider( - _i3.AmplifyAuthProviderToken? token, - _i3.AmplifyAuthProvider? authProvider, - ) => - super.noSuchMethod( - Invocation.method( - #registerAuthProvider, - [ - token, - authProvider, - ], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [AWSIamAmplifyAuthProvider]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAWSIamAmplifyAuthProvider extends _i1.Mock - implements _i3.AWSIamAmplifyAuthProvider { - MockAWSIamAmplifyAuthProvider() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.Future<_i2.AWSSignedRequest> authorizeRequest( - _i3.AWSBaseHttpRequest? request, { - _i3.AuthProviderOptions? options, - }) => - (super.noSuchMethod( - Invocation.method( - #authorizeRequest, - [request], - {#options: options}, - ), - returnValue: - _i7.Future<_i2.AWSSignedRequest>.value(_FakeAWSSignedRequest_0( - this, - Invocation.method( - #authorizeRequest, - [request], - {#options: options}, - ), - )), - ) as _i7.Future<_i2.AWSSignedRequest>); - @override - _i7.FutureOr<_i3.AWSCredentials> retrieve() => (super.noSuchMethod( - Invocation.method( - #retrieve, - [], - ), - returnValue: _i7.Future<_i3.AWSCredentials>.value(_FakeAWSCredentials_1( - this, - Invocation.method( - #retrieve, - [], - ), - )), - ) as _i7.FutureOr<_i3.AWSCredentials>); -} - -/// A class which mocks [UserProfile]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockUserProfile extends _i1.Mock implements _i3.UserProfile { - MockUserProfile() { - _i1.throwOnMissingStub(this); - } -} - -/// A class which mocks [AnalyticsClient]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAnalyticsClient extends _i1.Mock implements _i8.AnalyticsClient { - MockAnalyticsClient() { - _i1.throwOnMissingStub(this); - } - - @override - _i4.EndpointClient get endpointClient => (super.noSuchMethod( - Invocation.getter(#endpointClient), - returnValue: _FakeEndpointClient_2( - this, - Invocation.getter(#endpointClient), - ), - ) as _i4.EndpointClient); - @override - set endpointClient(_i4.EndpointClient? _endpointClient) => super.noSuchMethod( - Invocation.setter( - #endpointClient, - _endpointClient, - ), - returnValueForMissingStub: null, - ); - @override - _i5.EventClient get eventClient => (super.noSuchMethod( - Invocation.getter(#eventClient), - returnValue: _FakeEventClient_3( - this, - Invocation.getter(#eventClient), - ), - ) as _i5.EventClient); - @override - set eventClient(_i5.EventClient? _eventClient) => super.noSuchMethod( - Invocation.setter( - #eventClient, - _eventClient, - ), - returnValueForMissingStub: null, - ); - @override - _i7.Future init({ - required String? pinpointAppId, - required String? region, - required _i3.AWSCredentialsProvider? authProvider, - _i9.QueuedItemStore? eventStore, - }) => - (super.noSuchMethod( - Invocation.method( - #init, - [], - { - #pinpointAppId: pinpointAppId, - #region: region, - #authProvider: authProvider, - #eventStore: eventStore, - }, - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); -} - -/// A class which mocks [EndpointClient]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockEndpointClient extends _i1.Mock implements _i4.EndpointClient { - MockEndpointClient() { - _i1.throwOnMissingStub(this); - } - - @override - String get fixedEndpointId => (super.noSuchMethod( - Invocation.getter(#fixedEndpointId), - returnValue: '', - ) as String); - @override - set channelType(_i6.ChannelType? channelType) => super.noSuchMethod( - Invocation.setter( - #channelType, - channelType, - ), - returnValueForMissingStub: null, - ); - @override - set address(String? address) => super.noSuchMethod( - Invocation.setter( - #address, - address, - ), - returnValueForMissingStub: null, - ); - @override - set optOut(String? optOut) => super.noSuchMethod( - Invocation.setter( - #optOut, - optOut, - ), - returnValueForMissingStub: null, - ); - @override - _i7.Future addAttribute( - String? name, - String? value, - ) => - (super.noSuchMethod( - Invocation.method( - #addAttribute, - [ - name, - value, - ], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i7.Future removeAttribute(String? name) => (super.noSuchMethod( - Invocation.method( - #removeAttribute, - [name], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i7.Future addMetric( - String? name, - double? value, - ) => - (super.noSuchMethod( - Invocation.method( - #addMetric, - [ - name, - value, - ], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i7.Future removeMetric(String? name) => (super.noSuchMethod( - Invocation.method( - #removeMetric, - [name], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i7.Future setUser( - String? userId, - _i3.UserProfile? userProfile, - ) => - (super.noSuchMethod( - Invocation.method( - #setUser, - [ - userId, - userProfile, - ], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i6.PublicEndpoint getPublicEndpoint() => (super.noSuchMethod( - Invocation.method( - #getPublicEndpoint, - [], - ), - returnValue: _FakePublicEndpoint_4( - this, - Invocation.method( - #getPublicEndpoint, - [], - ), - ), - ) as _i6.PublicEndpoint); - @override - _i7.Future updateEndpoint() => (super.noSuchMethod( - Invocation.method( - #updateEndpoint, - [], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); -} - -/// A class which mocks [EventClient]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockEventClient extends _i1.Mock implements _i5.EventClient { - MockEventClient() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.Future recordEvent({ - required String? eventType, - _i6.Session? session, - _i3.CustomProperties? properties, - }) => - (super.noSuchMethod( - Invocation.method( - #recordEvent, - [], - { - #eventType: eventType, - #session: session, - #properties: properties, - }, - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - void registerGlobalProperties(_i3.CustomProperties? globalProperties) => - super.noSuchMethod( - Invocation.method( - #registerGlobalProperties, - [globalProperties], - ), - returnValueForMissingStub: null, - ); - @override - void unregisterGlobalProperties(List? propertyNames) => - super.noSuchMethod( - Invocation.method( - #unregisterGlobalProperties, - [propertyNames], - ), - returnValueForMissingStub: null, - ); - @override - _i7.Future flushEvents() => (super.noSuchMethod( - Invocation.method( - #flushEvents, - [], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); - @override - _i7.Future close() => (super.noSuchMethod( - Invocation.method( - #close, - [], - ), - returnValue: _i7.Future.value(), - returnValueForMissingStub: _i7.Future.value(), - ) as _i7.Future); -} diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.dart b/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.dart index e8655a5375..1095393419 100644 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.dart +++ b/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.dart @@ -5,15 +5,14 @@ import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:amplify_push_notifications_pinpoint/src/push_notifications_background_processing.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; -import 'push_notifications_background_processing_test.mocks.dart'; import 'test_data/fake_amplify_configuration.dart'; -@GenerateMocks( - [AmplifySecureStorage, AmplifyClass], -) +class MockAmplifyClass extends Mock implements AmplifyClass {} + +class MockAmplifySecureStorage extends Mock implements AmplifySecureStorage {} + void main() { final testWidgetsFlutterBinding = TestWidgetsFlutterBinding.ensureInitialized(); @@ -32,8 +31,9 @@ void main() { test('should fail when the config stored in secure storage is not found', () { final mockStorage = MockAmplifySecureStorage(); - when(mockStorage.read(key: anyNamed('key'))) - .thenAnswer((_) async => null); + when(() => mockStorage.read(key: any(named: 'key'))).thenAnswer( + (_) async => null, + ); expect( () async => amplifyBackgroundProcessing( @@ -46,13 +46,16 @@ void main() { test('should configure Amplify plugins', () async { log.clear(); final mockStorage = MockAmplifySecureStorage(); - when(mockStorage.read(key: anyNamed('key'))) - .thenAnswer((_) async => amplifyconfig); + when(() => mockStorage.read(key: any(named: 'key'))).thenAnswer( + (_) async => amplifyconfig, + ); + final mockAmplify = MockAmplifyClass(); - when(mockAmplify.isConfigured).thenReturn(false); - when(mockAmplify.addPlugins(any)).thenAnswer((realInvocation) async {}); - when(mockAmplify.configure(any)).thenAnswer((realInvocation) async {}); + when(() => mockAmplify.isConfigured).thenReturn(false); + when(() => mockAmplify.addPlugins(any())).thenAnswer((_) async {}); + when(() => mockAmplify.configure(any())).thenAnswer((_) async {}); + await amplifyBackgroundProcessing( amplifySecureStorage: mockStorage, amplify: mockAmplify, diff --git a/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.mocks.dart b/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.mocks.dart deleted file mode 100644 index 05df5e7138..0000000000 --- a/packages/notifications/push/amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.mocks.dart +++ /dev/null @@ -1,382 +0,0 @@ -// Mocks generated by Mockito 5.4.1 from annotations -// in amplify_push_notifications_pinpoint/test/push_notifications_background_processing_test.dart. -// Do not manually edit this file. - -// @dart=2.19 - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; - -import 'package:amplify_core/amplify_core.dart' as _i4; -import 'package:amplify_secure_storage/src/amplify_secure_storage.vm.dart' - as _i5; -import 'package:amplify_secure_storage_dart/amplify_secure_storage_dart.dart' - as _i2; -import 'package:aws_common/aws_common.dart' as _i3; -import 'package:mockito/mockito.dart' as _i1; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeAmplifySecureStorageConfig_0 extends _i1.SmartFake - implements _i2.AmplifySecureStorageConfig { - _FakeAmplifySecureStorageConfig_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAWSLogger_1 extends _i1.SmartFake implements _i3.AWSLogger { - _FakeAWSLogger_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); - - @override - String get runtimeTypeName => '_FakeAWSLogger_1'; -} - -class _FakeAuthCategory_2 extends _i1.SmartFake implements _i4.AuthCategory { - _FakeAuthCategory_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAnalyticsCategory_3 extends _i1.SmartFake - implements _i4.AnalyticsCategory { - _FakeAnalyticsCategory_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeStorageCategory_4 extends _i1.SmartFake - implements _i4.StorageCategory { - _FakeStorageCategory_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDataStoreCategory_5 extends _i1.SmartFake - implements _i4.DataStoreCategory { - _FakeDataStoreCategory_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAPICategory_6 extends _i1.SmartFake implements _i4.APICategory { - _FakeAPICategory_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmplifyHub_7 extends _i1.SmartFake implements _i4.AmplifyHub { - _FakeAmplifyHub_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNotificationsCategory_8 extends _i1.SmartFake - implements _i4.NotificationsCategory { - _FakeNotificationsCategory_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDependencyManager_9 extends _i1.SmartFake - implements _i4.DependencyManager { - _FakeDependencyManager_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmplifyAuthProviderRepository_10 extends _i1.SmartFake - implements _i4.AmplifyAuthProviderRepository { - _FakeAmplifyAuthProviderRepository_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmplifyConfig_11 extends _i1.SmartFake implements _i4.AmplifyConfig { - _FakeAmplifyConfig_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [AmplifySecureStorage]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAmplifySecureStorage extends _i1.Mock - implements _i5.AmplifySecureStorage { - MockAmplifySecureStorage() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.AmplifySecureStorageConfig get config => (super.noSuchMethod( - Invocation.getter(#config), - returnValue: _FakeAmplifySecureStorageConfig_0( - this, - Invocation.getter(#config), - ), - ) as _i2.AmplifySecureStorageConfig); - @override - String get runtimeTypeName => (super.noSuchMethod( - Invocation.getter(#runtimeTypeName), - returnValue: '', - ) as String); - @override - _i3.AWSLogger get logger => (super.noSuchMethod( - Invocation.getter(#logger), - returnValue: _FakeAWSLogger_1( - this, - Invocation.getter(#logger), - ), - ) as _i3.AWSLogger); - @override - _i6.Future delete({required String? key}) => (super.noSuchMethod( - Invocation.method( - #delete, - [], - {#key: key}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future read({required String? key}) => (super.noSuchMethod( - Invocation.method( - #read, - [], - {#key: key}, - ), - returnValue: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future write({ - required String? key, - required String? value, - }) => - (super.noSuchMethod( - Invocation.method( - #write, - [], - { - #key: key, - #value: value, - }, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future removeAll() => (super.noSuchMethod( - Invocation.method( - #removeAll, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); -} - -/// A class which mocks [AmplifyClass]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAmplifyClass extends _i1.Mock implements _i4.AmplifyClass { - MockAmplifyClass() { - _i1.throwOnMissingStub(this); - } - - @override - _i4.AuthCategory get Auth => (super.noSuchMethod( - Invocation.getter(#Auth), - returnValue: _FakeAuthCategory_2( - this, - Invocation.getter(#Auth), - ), - ) as _i4.AuthCategory); - @override - _i4.AnalyticsCategory get Analytics => (super.noSuchMethod( - Invocation.getter(#Analytics), - returnValue: _FakeAnalyticsCategory_3( - this, - Invocation.getter(#Analytics), - ), - ) as _i4.AnalyticsCategory); - @override - _i4.StorageCategory get Storage => (super.noSuchMethod( - Invocation.getter(#Storage), - returnValue: _FakeStorageCategory_4( - this, - Invocation.getter(#Storage), - ), - ) as _i4.StorageCategory); - @override - _i4.DataStoreCategory get DataStore => (super.noSuchMethod( - Invocation.getter(#DataStore), - returnValue: _FakeDataStoreCategory_5( - this, - Invocation.getter(#DataStore), - ), - ) as _i4.DataStoreCategory); - @override - _i4.APICategory get API => (super.noSuchMethod( - Invocation.getter(#API), - returnValue: _FakeAPICategory_6( - this, - Invocation.getter(#API), - ), - ) as _i4.APICategory); - @override - _i4.AmplifyHub get Hub => (super.noSuchMethod( - Invocation.getter(#Hub), - returnValue: _FakeAmplifyHub_7( - this, - Invocation.getter(#Hub), - ), - ) as _i4.AmplifyHub); - @override - _i4.NotificationsCategory get Notifications => (super.noSuchMethod( - Invocation.getter(#Notifications), - returnValue: _FakeNotificationsCategory_8( - this, - Invocation.getter(#Notifications), - ), - ) as _i4.NotificationsCategory); - @override - _i4.DependencyManager get dependencies => (super.noSuchMethod( - Invocation.getter(#dependencies), - returnValue: _FakeDependencyManager_9( - this, - Invocation.getter(#dependencies), - ), - ) as _i4.DependencyManager); - @override - _i4.AmplifyAuthProviderRepository get authProviderRepo => (super.noSuchMethod( - Invocation.getter(#authProviderRepo), - returnValue: _FakeAmplifyAuthProviderRepository_10( - this, - Invocation.getter(#authProviderRepo), - ), - ) as _i4.AmplifyAuthProviderRepository); - @override - bool get isConfigured => (super.noSuchMethod( - Invocation.getter(#isConfigured), - returnValue: false, - ) as bool); - @override - _i6.Future<_i4.AmplifyConfig> get asyncConfig => (super.noSuchMethod( - Invocation.getter(#asyncConfig), - returnValue: _i6.Future<_i4.AmplifyConfig>.value(_FakeAmplifyConfig_11( - this, - Invocation.getter(#asyncConfig), - )), - ) as _i6.Future<_i4.AmplifyConfig>); - @override - String get version => (super.noSuchMethod( - Invocation.getter(#version), - returnValue: '', - ) as String); - @override - _i6.Future addPlugin(_i4.AmplifyPluginInterface? plugin) => - (super.noSuchMethod( - Invocation.method( - #addPlugin, - [plugin], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future addPlugins(List<_i4.AmplifyPluginInterface>? plugins) => - (super.noSuchMethod( - Invocation.method( - #addPlugins, - [plugins], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future addPluginPlatform(_i4.AmplifyPluginInterface? plugin) => - (super.noSuchMethod( - Invocation.method( - #addPluginPlatform, - [plugin], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future configure(String? configuration) => (super.noSuchMethod( - Invocation.method( - #configure, - [configuration], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - @override - _i6.Future reset() => (super.noSuchMethod( - Invocation.method( - #reset, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); -}