import { test, describe } from 'node:test'; import assert from 'node:assert'; import type { Config, WorktreeInfo, CLIOptions, AppState, PanelType } from '../types/index.js'; describe('Type definitions', () => { test('Config type should have correct structure', () => { const config: Config = { worktreeLocation: '../', projectName: 'test-project', quickCommands: { test: 'npm test', build: 'npm run build' }, autoStart: { claudeCode: true } }; assert.strictEqual(config.worktreeLocation, '../'); assert.strictEqual(config.projectName, 'test-project'); assert.strictEqual(typeof config.quickCommands, 'object'); assert.strictEqual(config.autoStart.claudeCode, true); }); test('WorktreeInfo type should have correct structure', () => { const worktree: WorktreeInfo = { name: 'my-project-feature', path: '/path/to/worktree', branch: 'feature/test', exists: true }; assert.strictEqual(worktree.name, 'my-project-feature'); assert.strictEqual(worktree.path, '/path/to/worktree'); assert.strictEqual(worktree.branch, 'feature/test'); assert.strictEqual(worktree.exists, true); }); test('CLIOptions type should have correct optional properties', () => { const options1: CLIOptions = {}; const options2: CLIOptions = { location: '/custom/path', project: 'my-project', continue: true }; assert.strictEqual(typeof options1, 'object'); assert.strictEqual(options2.location, '/custom/path'); assert.strictEqual(options2.project, 'my-project'); assert.strictEqual(options2.continue, true); }); test('PanelType should be string literal type', () => { const claude: PanelType = 'claude'; const terminal: PanelType = 'terminal'; assert.strictEqual(claude, 'claude'); assert.strictEqual(terminal, 'terminal'); }); test('AppState type should have correct structure', () => { const mockWorktree: WorktreeInfo = { name: 'test', path: '/test', branch: 'test', exists: true }; const mockConfig: Config = { worktreeLocation: '../', projectName: null, quickCommands: {}, autoStart: { claudeCode: true } }; const appState: AppState = { activePanel: 'claude', worktree: mockWorktree, config: mockConfig, isExiting: false }; assert.strictEqual(appState.activePanel, 'claude'); assert.strictEqual(appState.isExiting, false); assert.strictEqual(typeof appState.worktree, 'object'); assert.strictEqual(typeof appState.config, 'object'); }); });