// Avoid pulling in the real config (which would require env vars). The // websocket module only reads config.ws.{port,token}, so a small stub is enough. jest.mock('../config', () => ({ ws: { port: 0, token: 'test-token' }, logLevel: 'error', })); const { proxyRequest } = require('../services/websocket'); describe('proxyRequest', () => { it('rejects when no remote agent is connected', async () => { await expect(proxyRequest({ method: 'GET', url: 'http://x' })).rejects.toThrow( 'No remote agent connected' ); }); });