Checkpoint: Connexion Microsoft 365 (Azure AD OAuth2) : migration DB azureAdId, helpers backend, route callback, bouton Login, page AzureCallback, tests OK
This commit is contained in:
21
server/azureAuth.test.ts
Normal file
21
server/azureAuth.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { isAzureAdConfigured, getAzureAuthUrl } from "./azureAuth";
|
||||
|
||||
describe("Azure AD configuration", () => {
|
||||
it("should detect Azure AD as configured when env vars are set", () => {
|
||||
// Les variables sont injectées via webdev_request_secrets
|
||||
const configured = isAzureAdConfigured();
|
||||
expect(configured).toBe(true);
|
||||
});
|
||||
|
||||
it("should generate a valid Azure AD auth URL", async () => {
|
||||
if (!isAzureAdConfigured()) {
|
||||
console.warn("Azure AD not configured, skipping URL test");
|
||||
return;
|
||||
}
|
||||
const url = await getAzureAuthUrl();
|
||||
expect(url).toContain("login.microsoftonline.com");
|
||||
expect(url).toContain("oauth2/v2.0/authorize");
|
||||
expect(url).toContain("f496da82-e18f-4567-bf05-8551ae6669b2"); // client_id
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user