From 32e1cb576e85a84a9555de0fe1b7a991f922d405 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sat, 7 Feb 2026 18:50:24 +1300 Subject: [PATCH] fix: Prevent ClaudeAPI test from making real HTTPS requests in CI The _makeRequest private method test was calling the real method which fires an actual HTTPS request to api.anthropic.com. The unhandled rejection from the 401 response crashed the Jest worker process. Simplified to verify method exists without triggering network calls. Co-Authored-By: Claude Opus 4.6 --- tests/unit/ClaudeAPI.test.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/unit/ClaudeAPI.test.js b/tests/unit/ClaudeAPI.test.js index 3d1ae589..639cb663 100644 --- a/tests/unit/ClaudeAPI.test.js +++ b/tests/unit/ClaudeAPI.test.js @@ -534,18 +534,9 @@ describe('ClaudeAPI Service', () => { ClaudeAPI._makeRequest = jest.fn(); }); - test('should construct proper HTTPS request', () => { - // This test verifies the method exists and has proper structure + test('should be a callable function', () => { expect(typeof ClaudeAPI._makeRequest).toBe('function'); - - const payload = { - model: 'claude-sonnet-4-5-20250929', - max_tokens: 1024, - messages: [{ role: 'user', content: 'Test' }] - }; - - // Verify the method accepts a payload parameter - expect(() => ClaudeAPI._makeRequest(payload)).not.toThrow(TypeError); + // Don't call _makeRequest with real params - it fires real HTTPS requests }); test('should include required headers in request', () => {