fix(auth): preserve explicit resume session continuity

Refs #1685
This commit is contained in:
Tam Nhu Tran committed 2026-08-08 21:17:01 -04:00
1 parent 7fb56d62e1
commit 6721d47502
6 files changed
+729 -9

No files matched your search

+13 -1
View File
@@ -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', () => {