From 41a4a601bfb3ae1d08f0d2b6d2b521ad04bb1a82 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Mon, 9 Mar 2026 17:26:49 +0000 Subject: [PATCH] fix: fixed ESLint errors in GraphApiService --- api/server/services/GraphApiService.js | 2 +- api/server/services/GraphApiService.spec.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/api/server/services/GraphApiService.js b/api/server/services/GraphApiService.js index 5837f74dd6..4eceaaf01d 100644 --- a/api/server/services/GraphApiService.js +++ b/api/server/services/GraphApiService.js @@ -88,7 +88,7 @@ const exchangeTokenForGraphAccess = async (config, accessToken, sub) => { if (process.env.PROXY && process.env.PROXY.trim()) { const httpsAgent = new HttpsProxyAgent(process.env.PROXY); clientOptions[Symbol.for('openid-client.custom.fetch')] = (url, options = {}) => { - return nodeFetch(url, { ...options, agent: httpsAgent }); + return nodeFetch(url, { ...options, agent: httpsAgent }); }; } diff --git a/api/server/services/GraphApiService.spec.js b/api/server/services/GraphApiService.spec.js index c6f2bab0a2..57bf3c4331 100644 --- a/api/server/services/GraphApiService.spec.js +++ b/api/server/services/GraphApiService.spec.js @@ -807,7 +807,6 @@ describe('GraphApiService', () => { describe('Proxy Configuration', () => { let originalEnv; const { ProxyAgent } = require('undici'); - const { HttpsProxyAgent } = require('https-proxy-agent'); beforeAll(() => { originalEnv = { ...process.env }; @@ -845,7 +844,7 @@ describe('GraphApiService', () => { expect(Client.init).toHaveBeenCalled(); const initCall = Client.init.mock.calls[0][0]; - + // fetchOptions should either not exist or not have a dispatcher if (initCall.fetchOptions) { expect(initCall.fetchOptions.dispatcher).toBeUndefined(); @@ -880,7 +879,7 @@ describe('GraphApiService', () => { if (client.genericGrantRequest) { expect(client.genericGrantRequest).toHaveBeenCalled(); const clientOptions = client.genericGrantRequest.mock.calls[0][3]; - + expect(clientOptions).toBeDefined(); const customFetchSymbol = Symbol.for('openid-client.custom.fetch'); expect(clientOptions[customFetchSymbol]).toBeDefined(); @@ -901,7 +900,7 @@ describe('GraphApiService', () => { if (client.genericGrantRequest) { expect(client.genericGrantRequest).toHaveBeenCalled(); const clientOptions = client.genericGrantRequest.mock.calls[0][3]; - + // clientOptions should be empty object or not have custom fetch expect(clientOptions).toEqual({}); } @@ -921,7 +920,7 @@ describe('GraphApiService', () => { if (client.genericGrantRequest) { const clientOptions = client.genericGrantRequest.mock.calls[0][3]; const customFetch = clientOptions[Symbol.for('openid-client.custom.fetch')]; - + expect(customFetch).toBeDefined(); expect(typeof customFetch).toBe('function'); } @@ -940,7 +939,7 @@ describe('GraphApiService', () => { if (client.genericGrantRequest) { const clientOptions = client.genericGrantRequest.mock.calls[0][3]; const customFetch = clientOptions[Symbol.for('openid-client.custom.fetch')]; - + // Test that custom fetch function is created with HttpsProxyAgent expect(customFetch).toBeDefined(); expect(typeof customFetch).toBe('function');