mirror of https://github.com/ghostfolio/ghostfolio
3 changed files with 38 additions and 1 deletions
@ -0,0 +1,20 @@ |
|||||
|
import { getOidcDiscoveryUrl } from './oidc.helper'; |
||||
|
|
||||
|
describe('getOidcDiscoveryUrl', () => { |
||||
|
it.each([ |
||||
|
[ |
||||
|
'https://auth.example.com', |
||||
|
'https://auth.example.com/.well-known/openid-configuration' |
||||
|
], |
||||
|
[ |
||||
|
'https://auth.example.com/', |
||||
|
'https://auth.example.com/.well-known/openid-configuration' |
||||
|
], |
||||
|
[ |
||||
|
'https://auth.example.com/application/o/ghostfolio/', |
||||
|
'https://auth.example.com/application/o/ghostfolio/.well-known/openid-configuration' |
||||
|
] |
||||
|
])('creates the discovery URL for %s', (issuer, expected) => { |
||||
|
expect(getOidcDiscoveryUrl(issuer)).toBe(expected); |
||||
|
}); |
||||
|
}); |
||||
@ -0,0 +1,3 @@ |
|||||
|
export function getOidcDiscoveryUrl(issuer: string) { |
||||
|
return `${issuer.replace(/\/+$/, '')}/.well-known/openid-configuration`; |
||||
|
} |
||||
Loading…
Reference in new issue