|
7 | 7 | isCliProvider, |
8 | 8 | isApiProvider, |
9 | 9 | isProcessProvider, |
| 10 | + isClaudeCodePlanCli, |
10 | 11 | enabledApiProviderFilter, |
11 | 12 | providerTypeClass, |
12 | 13 | getProviderTimeout, |
@@ -85,6 +86,32 @@ describe('provider type predicates', () => { |
85 | 86 | }); |
86 | 87 | }); |
87 | 88 |
|
| 89 | +describe('isClaudeCodePlanCli', () => { |
| 90 | + it('matches a headless claude CLI provider on the plan', () => { |
| 91 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', envVars: {} })).toBe(true); |
| 92 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude' })).toBe(true); |
| 93 | + }); |
| 94 | + |
| 95 | + it('does not match the interactive Claude Code TUI provider', () => { |
| 96 | + expect(isClaudeCodePlanCli({ type: 'tui', command: 'claude' })).toBe(false); |
| 97 | + }); |
| 98 | + |
| 99 | + it('does not match non-claude CLI providers', () => { |
| 100 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'gemini' })).toBe(false); |
| 101 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'codex' })).toBe(false); |
| 102 | + }); |
| 103 | + |
| 104 | + it('excludes Bedrock/Vertex-routed claude CLIs (billed via cloud, not the plan)', () => { |
| 105 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', envVars: { CLAUDE_CODE_USE_BEDROCK: '1' } })).toBe(false); |
| 106 | + expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', envVars: { CLAUDE_CODE_USE_VERTEX: '1' } })).toBe(false); |
| 107 | + }); |
| 108 | + |
| 109 | + it('safely returns false for nullish input', () => { |
| 110 | + expect(isClaudeCodePlanCli(null)).toBe(false); |
| 111 | + expect(isClaudeCodePlanCli(undefined)).toBe(false); |
| 112 | + }); |
| 113 | +}); |
| 114 | + |
88 | 115 | describe('enabledApiProviderFilter', () => { |
89 | 116 | it('keeps only enabled api providers', () => { |
90 | 117 | const list = [ |
|
0 commit comments