|
| 1 | +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +import 'package:flutter_test/flutter_test.dart'; |
| 5 | + |
| 6 | +import 'mock_method_channel.dart'; |
| 7 | + |
| 8 | +void main() { |
| 9 | + TestWidgetsFlutterBinding.ensureInitialized(); |
| 10 | + |
| 11 | + MockMethodChannel platform = MockMethodChannel(); |
| 12 | + |
| 13 | + test('init method for UnimplementedError', () async { |
| 14 | + Map<String, Object?> initConfig = { |
| 15 | + 'appId': 'testApp', |
| 16 | + 'endpoint': "", |
| 17 | + }; |
| 18 | + expect(() async { |
| 19 | + await platform.init(initConfig); |
| 20 | + }, throwsA(isInstanceOf<UnimplementedError>())); |
| 21 | + }); |
| 22 | + |
| 23 | + test('record method for UnimplementedError', () async { |
| 24 | + Map<String, Object?> attributes = { |
| 25 | + "category": "shoes", |
| 26 | + "currency": "CNY", |
| 27 | + "value": 279.9 |
| 28 | + }; |
| 29 | + expect(platform.record(attributes), |
| 30 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 31 | + }); |
| 32 | + |
| 33 | + test('setUserId method for UnimplementedError', () async { |
| 34 | + Map<String, Object?> attributes = { |
| 35 | + "userId": "1234", |
| 36 | + }; |
| 37 | + expect(platform.setUserId(attributes), |
| 38 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 39 | + }); |
| 40 | + |
| 41 | + test('setUserAttributes method for UnimplementedError', () async { |
| 42 | + Map<String, Object?> attributes = {"_user_age": 21, "_user_name": "carl"}; |
| 43 | + expect(platform.setUserAttributes(attributes), |
| 44 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 45 | + }); |
| 46 | + |
| 47 | + test('addGlobalAttributes method for UnimplementedError', () async { |
| 48 | + Map<String, Object?> attributes = { |
| 49 | + "channel": "Play Store", |
| 50 | + "level": 5.1, |
| 51 | + "class": 6 |
| 52 | + }; |
| 53 | + expect(platform.addGlobalAttributes(attributes), |
| 54 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 55 | + }); |
| 56 | + |
| 57 | + test('deleteGlobalAttributes method for UnimplementedError', () async { |
| 58 | + Map<String, Object?> attributes = { |
| 59 | + "attributes": ["attr1", "attr2"], |
| 60 | + }; |
| 61 | + expect(platform.deleteGlobalAttributes(attributes), |
| 62 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 63 | + }); |
| 64 | + |
| 65 | + test('updateConfigure method for UnimplementedError', () async { |
| 66 | + Map<String, Object?> attributes = { |
| 67 | + "appId": "newAppId", |
| 68 | + "endpoint": "https://example.com/collect", |
| 69 | + }; |
| 70 | + expect(platform.updateConfigure(attributes), |
| 71 | + throwsA(isInstanceOf<UnimplementedError>())); |
| 72 | + }); |
| 73 | + |
| 74 | + test('flushEvents method for UnimplementedError', () async { |
| 75 | + expect(platform.flushEvents(), throwsA(isInstanceOf<UnimplementedError>())); |
| 76 | + }); |
| 77 | + |
| 78 | + test('disable method for UnimplementedError', () async { |
| 79 | + expect(platform.disable(), throwsA(isInstanceOf<UnimplementedError>())); |
| 80 | + }); |
| 81 | + |
| 82 | + test('enable method for UnimplementedError', () async { |
| 83 | + expect(platform.enable(), throwsA(isInstanceOf<UnimplementedError>())); |
| 84 | + }); |
| 85 | +} |
0 commit comments