|
1 | 1 | import { Command } from 'commander'; |
2 | | -import { parseEnvironmentVariables, parseDomains, parseDomainsFile, escapeShellArg, joinShellArgs, parseVolumeMounts, isValidIPv4, isValidIPv6, parseDnsServers, parseDnsOverHttps, validateAgentImage, isAgentImagePreset, AGENT_IMAGE_PRESETS, processAgentImageOption, processLocalhostKeyword, validateSkipPullWithBuildLocal, validateAllowHostPorts, validateAllowHostServicePorts, applyHostServicePortsConfig, parseMemoryLimit, validateFormat, validateApiProxyConfig, buildRateLimitConfig, validateRateLimitFlags, hasRateLimitOptions, collectRulesetFile, validateApiTargetInAllowedDomains, DEFAULT_OPENAI_API_TARGET, DEFAULT_ANTHROPIC_API_TARGET, DEFAULT_COPILOT_API_TARGET, DEFAULT_GEMINI_API_TARGET, emitApiProxyTargetWarnings, emitCliProxyStatusLogs, warnClassicPATWithCopilotModel, formatItem, program, parseAgentTimeout, applyAgentTimeout, handlePredownloadAction, resolveApiTargetsToAllowedDomains, extractGhesDomainsFromEngineApiTarget, extractGhecDomainsFromServerUrl, checkDockerHost } from './cli'; |
| 2 | +import { parseEnvironmentVariables, parseDomains, parseDomainsFile, escapeShellArg, joinShellArgs, parseVolumeMounts, isValidIPv4, isValidIPv6, parseDnsServers, parseDnsOverHttps, validateAgentImage, isAgentImagePreset, AGENT_IMAGE_PRESETS, processAgentImageOption, processLocalhostKeyword, validateSkipPullWithBuildLocal, validateAllowHostPorts, validateAllowHostServicePorts, applyHostServicePortsConfig, parseMemoryLimit, validateFormat, validateApiProxyConfig, buildRateLimitConfig, validateRateLimitFlags, validateEnableOpenCodeFlag, hasRateLimitOptions, collectRulesetFile, validateApiTargetInAllowedDomains, DEFAULT_OPENAI_API_TARGET, DEFAULT_ANTHROPIC_API_TARGET, DEFAULT_COPILOT_API_TARGET, DEFAULT_GEMINI_API_TARGET, emitApiProxyTargetWarnings, emitCliProxyStatusLogs, warnClassicPATWithCopilotModel, formatItem, program, parseAgentTimeout, applyAgentTimeout, handlePredownloadAction, resolveApiTargetsToAllowedDomains, extractGhesDomainsFromEngineApiTarget, extractGhecDomainsFromServerUrl, checkDockerHost } from './cli'; |
3 | 3 | import { redactSecrets } from './redact-secrets'; |
4 | 4 | import * as fs from 'fs'; |
5 | 5 | import * as path from 'path'; |
@@ -1545,6 +1545,23 @@ describe('cli', () => { |
1545 | 1545 | }); |
1546 | 1546 | }); |
1547 | 1547 |
|
| 1548 | + describe('validateEnableOpenCodeFlag', () => { |
| 1549 | + it('should pass when both --enable-opencode and --enable-api-proxy are set', () => { |
| 1550 | + expect(validateEnableOpenCodeFlag(true, true)).toEqual({ valid: true }); |
| 1551 | + }); |
| 1552 | + it('should pass when --enable-opencode is false', () => { |
| 1553 | + expect(validateEnableOpenCodeFlag(false, false)).toEqual({ valid: true }); |
| 1554 | + }); |
| 1555 | + it('should pass when --enable-opencode is false and --enable-api-proxy is true', () => { |
| 1556 | + expect(validateEnableOpenCodeFlag(true, false)).toEqual({ valid: true }); |
| 1557 | + }); |
| 1558 | + it('should fail when --enable-opencode is true without --enable-api-proxy', () => { |
| 1559 | + const r = validateEnableOpenCodeFlag(false, true); |
| 1560 | + expect(r.valid).toBe(false); |
| 1561 | + expect(r.error).toContain('--enable-api-proxy'); |
| 1562 | + }); |
| 1563 | + }); |
| 1564 | + |
1548 | 1565 | describe('hasRateLimitOptions', () => { |
1549 | 1566 | it('should return false when no rate limit options set', () => { |
1550 | 1567 | expect(hasRateLimitOptions({})).toBe(false); |
|
0 commit comments