Skip to content

Commit f6b353f

Browse files
authored
refactor: extracting a variable to make a test more deteministic (#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*
1 parent d6ede1a commit f6b353f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ describe('AppSync API Key Authorization', () => {
9090
});
9191

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

9596
// WHEN
9697
new appsync.GraphqlApi(stack, 'API', {
@@ -100,7 +101,7 @@ describe('AppSync API Key Authorization', () => {
100101
defaultAuthorization: {
101102
authorizationType: appsync.AuthorizationType.API_KEY,
102103
apiKeyConfig: {
103-
expires: cdk.Expiration.after(cdk.Duration.days(10)),
104+
expires,
104105
},
105106
},
106107
},

0 commit comments

Comments
 (0)