Skip to content

Commit

Permalink
fix: Add new endpoint to tests and improve existing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
kostaspt committed Dec 13, 2024
1 parent 51eaec6 commit 5a69ed2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/clerk-js/src/utils/__tests__/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,25 +512,27 @@ describe('isAllowedRedirect', () => {

describe('createAllowedRedirectOrigins', () => {
it('contains the default allowed origin values if no value is provided', async () => {
const frontendApi = 'https://somename.clerk.accounts.dev';
const frontendApi = 'somename.clerk.accounts.dev';
const allowedRedirectOriginsValuesUndefined = createAllowedRedirectOrigins(undefined, frontendApi);
const allowedRedirectOriginsValuesEmptyArray = createAllowedRedirectOrigins([], frontendApi);

expect(allowedRedirectOriginsValuesUndefined).toEqual([
'http://localhost',
`https://${getETLDPlusOneFromFrontendApi(frontendApi)}`,
`https://*.${getETLDPlusOneFromFrontendApi(frontendApi)}`,
`https://somename.accounts.dev`,
`https://*.somename.accounts.dev`,
`https://somename.clerk.accounts.dev/oauth/authorize*`,
]);

expect(allowedRedirectOriginsValuesEmptyArray).toEqual([
'http://localhost',
`https://${getETLDPlusOneFromFrontendApi(frontendApi)}`,
`https://*.${getETLDPlusOneFromFrontendApi(frontendApi)}`,
`https://somename.accounts.dev`,
`https://*.somename.accounts.dev`,
`https://somename.clerk.accounts.dev/oauth/authorize*`,
]);
});

it('contains only the allowedRedirectOrigins options given', async () => {
const frontendApi = 'https://somename.clerk.accounts.dev';
const frontendApi = 'somename.clerk.accounts.dev';
const allowedRedirectOriginsValues = createAllowedRedirectOrigins(
['https://test.host', 'https://*.test.host'],
frontendApi,
Expand Down

0 comments on commit 5a69ed2

Please sign in to comment.