Skip to content

Commit

Permalink
chore: upgrade packages July 2024 (#157)
Browse files Browse the repository at this point in the history
* chore: upgrade root packages

* chore: upgrade test packages

* chore: remove node-fetch module
  • Loading branch information
AleF83 authored Jul 4, 2024
1 parent 0bdeb2e commit 145e9e3
Show file tree
Hide file tree
Showing 11 changed files with 764 additions and 11,309 deletions.
9 changes: 8 additions & 1 deletion e2e/helpers/authorization-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { Page } from 'playwright-chromium';

import { User } from '../types';

export default async (page: Page, parameters: URLSearchParams, user: User, redirect_uri: string): Promise<URL> => {
const authorizationEndpoint = async (
page: Page,
parameters: URLSearchParams,
user: User,
redirect_uri: string,
): Promise<URL> => {
const url = `${process.env.OIDC_AUTHORIZE_URL}?${parameters.toString()}`;
const response = await page.goto(url);
expect(response.ok()).toBeTruthy();
Expand All @@ -16,3 +21,5 @@ export default async (page: Page, parameters: URLSearchParams, user: User, redir
expect(redirectedUrl.origin).toEqual(redirect_uri);
return redirectedUrl;
};

export default authorizationEndpoint;
4 changes: 3 additions & 1 deletion e2e/helpers/grants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Page } from 'playwright-chromium';

import { User } from '../types';

export default async (page: Page, user: User): Promise<void> => {
const grantsEndpoint = async (page: Page, user: User): Promise<void> => {
const response = await page.goto(process.env.OIDC_GRANTS_URL);
expect(response.ok()).toBeTruthy();

Expand All @@ -13,3 +13,5 @@ export default async (page: Page, user: User): Promise<void> => {
await page.waitForNavigation();
expect(await page.content()).toMatchSnapshot();
};

export default grantsEndpoint;
7 changes: 3 additions & 4 deletions e2e/helpers/introspect-endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as fs from 'fs/promises';
import { Agent } from 'https';
import path from 'path';

import fetch from 'node-fetch';
import * as yaml from 'yaml';

export default async (
const introspectEndpoint = async (
token: string,
apiResourceId: string,
snapshotPropertyMatchers: Record<string, unknown> = {},
Expand All @@ -28,10 +26,11 @@ export default async (
method: 'POST',
body: requestBody,
headers,
agent: new Agent({ rejectUnauthorized: false }),
});

expect(response).toBeDefined();
const result = await response.json();
expect(result).toMatchSnapshot(snapshotPropertyMatchers);
};

export default introspectEndpoint;
8 changes: 3 additions & 5 deletions e2e/helpers/token-endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Agent } from 'https';

import { decode as decodeJWT } from 'jws';
import fetch from 'node-fetch';

export default async (
const tokenEndpoint = async (
parameters: URLSearchParams,
snapshotPropertyMatchers: Record<string, unknown> = {},
): Promise<string> => {
Expand All @@ -13,7 +10,6 @@ export default async (
'Content-Type': 'application/x-www-form-urlencoded',
},
body: parameters.toString(),
agent: new Agent({ rejectUnauthorized: false }),
});
const result = await tokenEndpointResponse.json();
expect(result.access_token).toBeDefined();
Expand All @@ -23,3 +19,5 @@ export default async (
expect(decodedToken).toMatchSnapshot(snapshotPropertyMatchers);
return token as string;
};

export default tokenEndpoint;
12 changes: 6 additions & 6 deletions e2e/helpers/user-info-endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Agent } from 'https';

import fetch from 'node-fetch';

export default async (token: string, snapshotPropertyMatchers: Record<string, unknown> = {}): Promise<void> => {
const userInfoEndpoint = async (
token: string,
snapshotPropertyMatchers: Record<string, unknown> = {},
): Promise<void> => {
const response = await fetch(process.env.OIDC_USERINFO_URL, {
headers: { authorization: `Bearer ${token}` },
agent: new Agent({ rejectUnauthorized: false }),
});
const result = await response.json();
expect(result).toMatchSnapshot(snapshotPropertyMatchers);
};

export default userInfoEndpoint;
Loading

0 comments on commit 145e9e3

Please sign in to comment.