import { describe, expect, it } from 'vitest'; import { isOidcEnabled } from '../../src/lib/config.js'; describe('isOidcEnabled', () => { it('true ssi 3 vars Authentik present', () => { expect( isOidcEnabled({ authentikIssuer: 'https://auth.example/', authentikJwksUri: 'https://auth.example/jwks', authentikAudience: 'aud', }), ).toBe(true); }); it('false si l une des 3 manque', () => { expect( isOidcEnabled({ authentikIssuer: 'https://auth.example/', authentikJwksUri: undefined, authentikAudience: 'aud', }), ).toBe(false); expect( isOidcEnabled({ authentikIssuer: 'https://auth.example/', authentikJwksUri: 'https://auth.example/jwks', authentikAudience: undefined, }), ).toBe(false); expect( isOidcEnabled({ authentikIssuer: undefined, authentikJwksUri: 'https://auth.example/jwks', authentikAudience: 'aud', }), ).toBe(false); }); it('false si toutes vides', () => { expect( isOidcEnabled({ authentikIssuer: undefined, authentikJwksUri: undefined, authentikAudience: undefined, }), ).toBe(false); }); });