aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
119 stars 65 forks source link

fix: Update false-negative test case in Authentication.test #439

Closed adebayor123 closed 1 year ago

adebayor123 commented 1 year ago

Details

Addresses the concern from https://github.com/aws-observability/aws-rum-web/pull/436.

nit: This test will pass under certain conditions when it should fail (i.e., false negative).

Specifically, when this.credentials.expiration is undefined, and the expiration property of the value returned by AnonymousStorageCredentialsProvider is a Date object. When this happens, control flow will reach AnonymousCognitoCredentialsProvider, and the test needs a way to distinguish the value returned here from the expected value.

You can fix this by mocking the response of getCredentials, like was done in EnhancedAuthentication.test.ts here.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.