Skip to content

Commit aa89197

Browse files
committed
test: improve integration test wording
1 parent 1cbc9fa commit aa89197

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

packages/auth/amplify_auth_cognito_test/test/plugin/fetch_current_device_test.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ void main() {
2323
late DeviceMetadataRepository repo;
2424
late AmplifyAuthCognitoDart plugin;
2525

26-
Future<String?> getDeviceKey() async {
27-
final secrets = await repo.get(username);
28-
return secrets?.deviceKey;
29-
}
30-
3126
group('fetchCurrentDevice', () {
3227
setUp(() async {
3328
final secureStorage = MockSecureStorage();
@@ -47,7 +42,7 @@ void main() {
4742
repo = plugin.stateMachine.getOrCreate<DeviceMetadataRepository>();
4843
});
4944

50-
group('Cognito GetDevice returns successfully', () {
45+
group('Cognito GetDevice returns successfully.', () {
5146
setUp(() async {
5247
final mockIdp = MockCognitoIdentityProviderClient(
5348
getDevice: () async => mockDeviceResponse,
@@ -57,16 +52,17 @@ void main() {
5752
});
5853

5954
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',
6156
() async {
62-
final currentDeviceKey = await getDeviceKey();
57+
final secrets = await repo.get(username);
58+
final currentDeviceKey = secrets?.deviceKey;
6359
expect(currentDeviceKey, isNotNull);
6460
final currentDevice = await plugin.fetchCurrentDevice();
6561
expect(currentDeviceKey, currentDevice.id);
6662
});
6763

6864
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',
7066
() async {
7167
await plugin.forgetDevice();
7268
await expectLater(
@@ -76,7 +72,8 @@ void main() {
7672
});
7773
});
7874

79-
group('Cognito GetDevice throws AWSHttpException', () {
75+
group('This test should have Cognito GetDevice throw a AWSHttpException',
76+
() {
8077
setUp(() async {
8178
final mockIdp = MockCognitoIdentityProviderClient(
8279
getDevice: () async => throw AWSHttpException(
@@ -86,7 +83,8 @@ void main() {
8683
plugin.stateMachine.addInstance<CognitoIdentityProviderClient>(mockIdp);
8784
});
8885

89-
test('should throw a NetworkException', () async {
86+
test('This test should have Cognito GetDevice throw a NetworkException',
87+
() async {
9088
await expectLater(
9189
plugin.fetchCurrentDevice,
9290
throwsA(isA<NetworkException>()),

0 commit comments

Comments
 (0)