Files
ccs/tests
kaitranntt 2b0717ed53 feat(hooks): add UX improvements for image analysis hook
Add comprehensive UX enhancements for the image analysis CLIProxy hook:

- Add `ccs config image-analysis` CLI command for managing settings
  - Enable/disable toggle
  - Timeout configuration (10-600s)
  - Per-provider model configuration
  - Status display with provider models

- Add specialized error handlers with actionable messages
  - File too large (with compression hints)
  - CLIProxy unavailable (with start instructions)
  - Auth failure (with re-auth commands)
  - Timeout (with increase timeout hint)
  - Rate limit (with retry guidance)
  - API error (with response body parsing)

- Add comprehensive debug output (CCS_DEBUG=1)
  - Provider name and model
  - File size and media type
  - Timeout and endpoint
  - Skip reasons with context

- Add help text updates
  - `ccs --help` includes Image Analysis section
  - `ccs config --help` lists image-analysis subcommand

- Add doctor integration
  - Validates image_analysis config
  - Checks enabled status, providers, timeout
  - Warns if CLIProxy not running

- Add unit tests for new config command
2026-02-03 22:14:52 -05:00
..

CCS Test Suite

Organization

tests/
├── unit/              # Module unit tests (Mocha)
│   ├── glmt/          # GLMT transformer tests
│   └── delegation/    # Delegation module tests
├── npm/               # npm package tests (Mocha)
├── native/            # Native installation tests (bash/PowerShell)
│   ├── unix/          # Unix/Linux/macOS tests
│   └── windows/       # Windows PowerShell tests
├── integration/       # Integration tests (manual execution)
└── shared/            # Shared utilities
    ├── fixtures/      # Test configuration and environment
    ├── unit/          # Helper function tests
    ├── helpers.sh     # Bash test utilities
    └── test-data.js   # Test data for npm tests

Running Tests

bun run test           # All automated tests (unit + npm)
bun run test:unit      # Unit tests only (Mocha)
bun run test:npm       # npm package tests (Mocha)
bun run test:native    # Native Unix tests (bash)

Test Categories

Unit Tests (unit/)

Module-level tests using Mocha framework:

  • unit/glmt/ - GLMT transformer, SSE parser, delta accumulator
  • unit/delegation/ - Permission mode, session manager, result formatter

npm Tests (npm/)

npm package functionality tests using Mocha:

  • postinstall.test.js - Postinstall behavior
  • cli.test.js - CLI argument parsing
  • cross-platform.test.js - Cross-platform compatibility
  • special-commands.test.js - Integration tests

Native Tests (native/)

Installation tests for curl|bash (Unix) and irm|iex (Windows):

  • native/unix/edge-cases.sh - Unix edge case tests
  • native/windows/edge-cases.ps1 - Windows edge case tests

Integration Tests (integration/)

Manual execution tests for specific scenarios:

  • token-counting-test.js - Token counting validation
  • z-ai-streaming-test.js - Z.AI streaming
  • glmt-integration-test.sh - GLMT integration
  • symlink-chain-test.sh - Symlink chain handling
  • ux-integration-test.sh - CLI UX integration

Adding New Tests

  • Unit tests: Add to unit/<module>/ using Mocha + Node.js assert
  • npm tests: Add to npm/ using Mocha
  • Native tests: Add to native/unix/ or native/windows/
  • Integration tests: Add to integration/