Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NSeydoux committed Jan 15, 2025
1 parent 28e8c8d commit 3990a88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/browser/src/login/oidc/ClientRegistrar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe("ClientRegistrar", () => {
it("retrieves client id and secret from storage if they are present", async () => {
const clientId = randomUUID();
const clientSecret = randomUUID();
const expiresAt = Date.now() + 1000;
const expiresAt = Math.ceil((Date.now() + 100_000) / 1000);
const clientRegistrar = getClientRegistrar({
storage: mockStorageUtility(
{
Expand Down Expand Up @@ -188,7 +188,8 @@ describe("ClientRegistrar", () => {
const renewedClient: IOpenIdDynamicClient = {
clientId: randomUUID(),
clientSecret: randomUUID(),
expiresAt: Date.now() + 1000,
// Date.now is in ms, and the expiration date is in seconds.
expiresAt: Math.ceil((Date.now() + 100_000) / 1000),
clientType: "dynamic",
};
const { registerClient: mockedRegisterClient } = jest.requireMock(
Expand All @@ -198,7 +199,8 @@ describe("ClientRegistrar", () => {
const expiredClient: IOpenIdDynamicClient = {
clientId: randomUUID(),
clientSecret: randomUUID(),
expiresAt: Date.now() - 1000,
// Date.now is in ms, and the expiration date is in seconds.
expiresAt: Math.ceil((Date.now() - 100_000) / 1000),
clientType: "dynamic",
};

Expand Down Expand Up @@ -278,7 +280,7 @@ describe("ClientRegistrar", () => {
const client: IOpenIdDynamicClient = {
clientId: randomUUID(),
clientSecret: randomUUID(),
expiresAt: Date.now() + 1000,
expiresAt: Math.ceil((Date.now() + 10_000) / 1000),
clientType: "dynamic",
};
const { registerClient: mockedRegisterClient } = jest.requireMock(
Expand Down
1 change: 0 additions & 1 deletion packages/browser/src/login/oidc/ClientRegistrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export default class ClientRegistrar implements IClientRegistrar {
}

try {
console.log(`Registering a new client`);
const registeredClient = await registerClient(options, issuerConfig);
// Save info
const infoToSave: Record<string, string> = {
Expand Down

0 comments on commit 3990a88

Please sign in to comment.