Skip to content

Commit 4a1df7f

Browse files
committed
test(auth): add test for mapping user pool endpoint config
1 parent 5a6e7b9 commit 4a1df7f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

packages/amplify_core/test/config/amplify_outputs_mapping/amplify_outputs_mapping_test.dart

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ void main() {
106106
final mappedOutputs = amplifyConfig.toAmplifyOutputs();
107107
expect(mappedOutputs.auth?.passwordPolicy, null);
108108
});
109+
110+
test('maps config with user pool endpoint', () async {
111+
final configJson =
112+
jsonDecode(endpointConfig) as Map<String, Object?>;
113+
final amplifyConfig = AmplifyConfig.fromJson(configJson);
114+
final mappedOutputs = amplifyConfig.toAmplifyOutputs();
115+
expect(mappedOutputs.auth?.userPoolEndpoint, userPoolEndpoint);
116+
});
109117
});
110118
});
111119
}
@@ -268,3 +276,40 @@ Map<String, Object?> updateConfig(Map<String, Object?> config) {
268276
];
269277
return config;
270278
}
279+
280+
const userPoolEndpoint = 'https://fake-user-pool-endpoint.com';
281+
282+
const endpointConfig = r'''{
283+
"UserAgent": "aws-amplify-cli/2.0",
284+
"Version": "1.0",
285+
"auth": {
286+
"plugins": {
287+
"awsCognitoAuthPlugin": {
288+
"IdentityManager": {
289+
"Default": {}
290+
},
291+
"CredentialsProvider": {
292+
"CognitoIdentity": {
293+
"Default": {
294+
"PoolId": "fake-pool-id",
295+
"Region": "us-east-1"
296+
}
297+
}
298+
},
299+
"CognitoUserPool": {
300+
"Default": {
301+
"PoolId": "fake-pool-id",
302+
"AppClientId": "fake-client-id",
303+
"Region": "us-east-1",
304+
"Endpoint": "https://fake-user-pool-endpoint.com"
305+
}
306+
},
307+
"Auth": {
308+
"Default": {
309+
"authenticationFlowType": "USER_SRP_AUTH"
310+
}
311+
}
312+
}
313+
}
314+
}
315+
}''';

0 commit comments

Comments
 (0)