Skip to content

Commit

Permalink
refactor: extracting a variable to make a test more deteministic (aws…
Browse files Browse the repository at this point in the history
…#23173)

There has been at least one pipeline failure due to a 1 ms difference between the actual and expected values in this test.

Extract the expiration value to reuse it for input and expectation.

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
otaviomacedo authored and Brennan Ho committed Dec 9, 2022
1 parent ad8d884 commit f6dbc97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts
Expand Up @@ -90,7 +90,8 @@ describe('AppSync API Key Authorization', () => {
});

test('apiKeyConfig creates default with valid expiration date', () => {
const expirationDate: number = cdk.Expiration.after(cdk.Duration.days(10)).toEpoch();
const expires = cdk.Expiration.after(cdk.Duration.days(10));
const expirationDate: number = expires.toEpoch();

// WHEN
new appsync.GraphqlApi(stack, 'API', {
Expand All @@ -100,7 +101,7 @@ describe('AppSync API Key Authorization', () => {
defaultAuthorization: {
authorizationType: appsync.AuthorizationType.API_KEY,
apiKeyConfig: {
expires: cdk.Expiration.after(cdk.Duration.days(10)),
expires,
},
},
},
Expand Down

0 comments on commit f6dbc97

Please sign in to comment.