make kestrel a tak server, so that it can send and receive pois as cots data
Some checks failed
ci/woodpecker/pr/pr Pipeline failed
Some checks failed
ci/woodpecker/pr/pr Pipeline failed
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
getCodeChallenge,
|
||||
getOidcRedirectUri,
|
||||
getOidcConfig,
|
||||
buildAuthorizeUrl,
|
||||
exchangeCode,
|
||||
} from '../../server/utils/oidc.js'
|
||||
|
||||
describe('oidc', () => {
|
||||
@@ -121,5 +123,31 @@ describe('oidc', () => {
|
||||
const config = await getOidcConfig()
|
||||
expect(config).toBeNull()
|
||||
})
|
||||
|
||||
it('returns null when only some OIDC env vars set', async () => {
|
||||
process.env.OIDC_ISSUER = 'https://idp.example.com'
|
||||
process.env.OIDC_CLIENT_ID = 'client'
|
||||
delete process.env.OIDC_CLIENT_SECRET
|
||||
const config = await getOidcConfig()
|
||||
expect(config).toBeNull()
|
||||
delete process.env.OIDC_ISSUER
|
||||
delete process.env.OIDC_CLIENT_ID
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildAuthorizeUrl', () => {
|
||||
it('is a function that accepts config and params', () => {
|
||||
expect(typeof buildAuthorizeUrl).toBe('function')
|
||||
expect(buildAuthorizeUrl.length).toBe(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('exchangeCode', () => {
|
||||
it('rejects when grant fails', async () => {
|
||||
const config = {}
|
||||
const currentUrl = 'https://app/api/auth/oidc/callback?code=abc&state=s'
|
||||
const checks = { state: 's', nonce: 'n', codeVerifier: 'v' }
|
||||
await expect(exchangeCode(config, currentUrl, checks)).rejects.toBeDefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user