From 0228e37fc79e871fc379ad5fb8c66272a3c0fea6 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Mon, 9 Mar 2026 18:05:13 +0000 Subject: [PATCH] fix: update proxy handling in GraphApiService tests --- api/server/services/GraphApiService.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/server/services/GraphApiService.spec.js b/api/server/services/GraphApiService.spec.js index 532e946024..ea4cd2f0cb 100644 --- a/api/server/services/GraphApiService.spec.js +++ b/api/server/services/GraphApiService.spec.js @@ -52,6 +52,7 @@ describe('GraphApiService', () => { afterEach(() => { // Clean up environment variables delete process.env.OPENID_GRAPH_SCOPES; + delete process.env.PROXY; }); beforeEach(async () => { @@ -813,7 +814,6 @@ describe('GraphApiService', () => { }); beforeEach(() => { - jest.resetModules(); process.env = { ...originalEnv }; jest.clearAllMocks(); }); @@ -851,7 +851,7 @@ describe('GraphApiService', () => { } }); - it('should pass correct proxy URL to ProxyAgent', async () => { + it('should create ProxyAgent dispatcher for any configured proxy URL', async () => { const proxyUrl = 'http://custom-proxy.example.com:3128'; process.env.PROXY = proxyUrl; mockTokensCache.get.mockResolvedValue(null); @@ -860,8 +860,6 @@ describe('GraphApiService', () => { const initCall = Client.init.mock.calls[0][0]; expect(initCall.fetchOptions.dispatcher).toBeInstanceOf(ProxyAgent); - // ProxyAgent is initialized with the proxy URL - expect(initCall.fetchOptions.dispatcher).toBeDefined(); }); });