Skip to content

Commit

Permalink
chore: reenable auth token test validating generating api token for 1…
Browse files Browse the repository at this point in the history
… day
  • Loading branch information
bruuuuuuuce committed Dec 6, 2023
1 parent cbd7fd1 commit 5f02d31
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/common-integration-tests/src/auth-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ export function runAuthClientTests(
);
});

// this test is sensitive to clock skew inside of github actions, skipping it for now
it.skip('should succeed for generating an api token that expires', async () => {
it('should succeed for generating an api token that expires', async () => {
const secondsSinceEpoch = Math.round(Date.now() / 1000);
const expireResponse = await sessionTokenAuthClient.generateApiKey(
SUPER_USER_PERMISSIONS,
ExpiresIn.minutes(5)
ExpiresIn.days(1)
);

const expiresIn = secondsSinceEpoch + 300;
const oneHourInSeconds = 60 * 60;
const oneDayInSeconds = oneHourInSeconds * 24;
const expiresIn = secondsSinceEpoch + oneDayInSeconds;

expectWithMessage(
() => expect(expireResponse).toBeInstanceOf(GenerateApiKey.Success),
Expand All @@ -82,8 +82,8 @@ export function runAuthClientTests(
const expireResponseSuccess = expireResponse as GenerateApiKey.Success;
expect(expireResponseSuccess.expiresAt.doesExpire());
expect(expireResponseSuccess.expiresAt.epoch()).toBeWithin(
expiresIn - 60,
expiresIn + 60
expiresIn - oneHourInSeconds,
expiresIn + oneHourInSeconds
);
});

Expand Down

0 comments on commit 5f02d31

Please sign in to comment.