/** * test/desktop/shell.test.ts — unit tests for defaultShellForPlatform (B1). * * Covers every platform branch, with and without env.SHELL set. */ import { describe, test, expect } from 'vitest' import { defaultShellForPlatform } from '../../desktop/src/shell.js' describe('defaultShellForPlatform', () => { test('returns powershell.exe on win32 regardless of env.SHELL', () => { // Arrange / Act / Assert expect(defaultShellForPlatform('win32', {})).toBe('powershell.exe') expect(defaultShellForPlatform('win32', { SHELL: '/bin/zsh' })).toBe('powershell.exe') }) test('returns env.SHELL on darwin when it is set', () => { // Arrange const env = { SHELL: '/opt/homebrew/bin/fish' } // Act const result = defaultShellForPlatform('darwin', env) // Assert expect(result).toBe('/opt/homebrew/bin/fish') }) test('falls back to /bin/zsh on darwin when env.SHELL is unset', () => { expect(defaultShellForPlatform('darwin', {})).toBe('/bin/zsh') }) test('returns env.SHELL on linux when it is set', () => { expect(defaultShellForPlatform('linux', { SHELL: '/usr/bin/bash' })).toBe('/usr/bin/bash') }) test('falls back to /bin/bash on linux when env.SHELL is unset', () => { expect(defaultShellForPlatform('linux', {})).toBe('/bin/bash') }) })