mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-20 00:14:58 +00:00
1 parent
7fb56d62e1
commit
6721d47502
6 files changed
+729
-9
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { detectShell, formatExport } from '../../../src/codex-auth/shell-detect';
|
||||
import { detectShell, formatExport, formatUnset } from '../../../src/codex-auth/shell-detect';
|
||||
import type { Shell } from '../../../src/codex-auth/shell-detect';
|
||||
|
||||
// ── detectShell ───────────────────────────────────────────────────────────────
|
||||
@@ -146,6 +146,18 @@ describe('formatExport — cmd', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatUnset', () => {
|
||||
it('formats environment removal for every supported shell', () => {
|
||||
expect(formatUnset('bash', 'ANTHROPIC_BASE_URL')).toBe('unset ANTHROPIC_BASE_URL');
|
||||
expect(formatUnset('zsh', 'ANTHROPIC_BASE_URL')).toBe('unset ANTHROPIC_BASE_URL');
|
||||
expect(formatUnset('fish', 'ANTHROPIC_BASE_URL')).toBe('set -e ANTHROPIC_BASE_URL;');
|
||||
expect(formatUnset('pwsh', 'ANTHROPIC_BASE_URL')).toBe(
|
||||
'Remove-Item Env:ANTHROPIC_BASE_URL -ErrorAction SilentlyContinue'
|
||||
);
|
||||
expect(formatUnset('cmd', 'ANTHROPIC_BASE_URL')).toBe('set "ANTHROPIC_BASE_URL="');
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatExport — each shell produces distinct syntax', () => {
|
||||
const shells: Shell[] = ['bash', 'zsh', 'fish', 'pwsh', 'cmd'];
|
||||
it('all shells produce different output for same input', () => {
|
||||
|
||||
Reference in new issue
Block a user