diff options
Diffstat (limited to 'packages/core/src/tools/mcp-client.test.ts')
| -rw-r--r-- | packages/core/src/tools/mcp-client.test.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/core/src/tools/mcp-client.test.ts b/packages/core/src/tools/mcp-client.test.ts index b8f61856..32cffae1 100644 --- a/packages/core/src/tools/mcp-client.test.ts +++ b/packages/core/src/tools/mcp-client.test.ts @@ -12,6 +12,7 @@ import { isEnabled, hasValidTypes, McpClient, + hasNetworkTransport, } from './mcp-client.js'; import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; import * as SdkClientStdioLib from '@modelcontextprotocol/sdk/client/stdio.js'; @@ -566,4 +567,34 @@ describe('mcp-client', () => { expect(hasValidTypes(schema)).toBe(true); }); }); + + describe('hasNetworkTransport', () => { + it('should return true if only url is provided', () => { + const config = { url: 'http://example.com' }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return true if only httpUrl is provided', () => { + const config = { httpUrl: 'http://example.com' }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return true if both url and httpUrl are provided', () => { + const config = { + url: 'http://example.com/sse', + httpUrl: 'http://example.com/http', + }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return false if neither url nor httpUrl is provided', () => { + const config = { command: 'do-something' }; + expect(hasNetworkTransport(config)).toBe(false); + }); + + it('should return false for an empty config object', () => { + const config = {}; + expect(hasNetworkTransport(config)).toBe(false); + }); + }); }); |
