@@ -23,11 +23,6 @@ void main() {
23
23
late DeviceMetadataRepository repo;
24
24
late AmplifyAuthCognitoDart plugin;
25
25
26
- Future <String ?> getDeviceKey () async {
27
- final secrets = await repo.get (username);
28
- return secrets? .deviceKey;
29
- }
30
-
31
26
group ('fetchCurrentDevice' , () {
32
27
setUp (() async {
33
28
final secureStorage = MockSecureStorage ();
@@ -47,7 +42,7 @@ void main() {
47
42
repo = plugin.stateMachine.getOrCreate <DeviceMetadataRepository >();
48
43
});
49
44
50
- group ('Cognito GetDevice returns successfully' , () {
45
+ group ('Cognito GetDevice returns successfully. ' , () {
51
46
setUp (() async {
52
47
final mockIdp = MockCognitoIdentityProviderClient (
53
48
getDevice: () async => mockDeviceResponse,
@@ -57,16 +52,17 @@ void main() {
57
52
});
58
53
59
54
test (
60
- 'should get the current device. current device id should be equal to the local device id' ,
55
+ 'This test should get the current device, where the current device id is equal to the local device id' ,
61
56
() async {
62
- final currentDeviceKey = await getDeviceKey ();
57
+ final secrets = await repo.get (username);
58
+ final currentDeviceKey = secrets? .deviceKey;
63
59
expect (currentDeviceKey, isNotNull);
64
60
final currentDevice = await plugin.fetchCurrentDevice ();
65
61
expect (currentDeviceKey, currentDevice.id);
66
62
});
67
63
68
64
test (
69
- 'should should throw a DeviceNotTrackedException when current device key is null' ,
65
+ 'This test should throw a DeviceNotTrackedException when current device key is null' ,
70
66
() async {
71
67
await plugin.forgetDevice ();
72
68
await expectLater (
@@ -76,7 +72,8 @@ void main() {
76
72
});
77
73
});
78
74
79
- group ('Cognito GetDevice throws AWSHttpException' , () {
75
+ group ('This test should have Cognito GetDevice throw a AWSHttpException' ,
76
+ () {
80
77
setUp (() async {
81
78
final mockIdp = MockCognitoIdentityProviderClient (
82
79
getDevice: () async => throw AWSHttpException (
@@ -86,7 +83,8 @@ void main() {
86
83
plugin.stateMachine.addInstance <CognitoIdentityProviderClient >(mockIdp);
87
84
});
88
85
89
- test ('should throw a NetworkException' , () async {
86
+ test ('This test should have Cognito GetDevice throw a NetworkException' ,
87
+ () async {
90
88
await expectLater (
91
89
plugin.fetchCurrentDevice,
92
90
throwsA (isA <NetworkException >()),
0 commit comments