This repository was archived by the owner on Jun 4, 2026. It is now read-only.
Description Test Suite Implementation Plan
Overview
Add comprehensive test coverage to boxel-cli. Currently Vitest is configured but no tests exist.
Test Categories
Priority 1: Unit Tests (Pure Functions)
These require no mocking and provide immediate value:
batch-upload.ts
edit-lock.ts
sync.ts - Action Computation
profile-manager.ts
Priority 2: File-Based Tests (Temp Directories)
checkpoint-manager.ts
realm-config.ts
Priority 3: Integration Tests (Mock HTTP)
sync command
track command
watch command
status command
Proposed Structure
src/
__mocks__/
fs.ts # Mock file system
fetch.ts # Mock HTTP calls
matrix-client.ts # Stub auth client
__tests__/
unit/
batch-upload.test.ts
edit-lock.test.ts
sync-actions.test.ts
profile-manager.test.ts
checkpoint-manager.test.ts
realm-config.test.ts
integration/
sync.test.ts
track.test.ts
watch.test.ts
status.test.ts
fixtures/
manifests/ # Sample .boxel-sync.json files
workspaces/ # Test workspace structures
Mock Strategy
Dependency
Mock Approach
fs
In-memory file system or temp directories
fetch
Mock responses for Matrix/Boxel APIs
MatrixClient
Stub that returns test JWT
child_process
Mock git commands
fs.watch
Event emitter simulation
Implementation Order
Setup - Configure Vitest, create mock utilities
batch-upload.test.ts - Easiest wins, pure functions
edit-lock.test.ts - Simple file operations
sync-actions.test.ts - Critical conflict logic
checkpoint-manager.test.ts - Core feature
Integration tests - Full command flows
Success Criteria
Notes
Vitest already configured in package.json
Focus on testing logic, not CLI output formatting
Use temp directories for file-based tests to avoid pollution
Mock network calls to avoid flaky tests
Reactions are currently unavailable
Test Suite Implementation Plan
Overview
Add comprehensive test coverage to boxel-cli. Currently Vitest is configured but no tests exist.
Test Categories
Priority 1: Unit Tests (Pure Functions)
These require no mocking and provide immediate value:
batch-upload.tssortDefinitionsFirst()- .gts files sorted before .jsoncreateBatches()- respects batch size and payload limitsbuildAtomicRequest()- correct JSON:API format for /_atomicedit-lock.tsaddToEditLock()- adds file to lock listremoveFromEditLock()- removes file from lock listisFileBeingEdited()- correctly identifies locked filesgetEditingFiles()- returns all locked filessync.ts- Action Computationprofile-manager.tsgetEnvironmentFromMatrixId()- detects staging vs productionPriority 2: File-Based Tests (Temp Directories)
checkpoint-manager.tscreateCheckpoint()- creates git commit with changesrestore()- reverts to previous checkpointgetMilestones()- lists tagged checkpointsmarkMilestone()/unmarkMilestone()realm-config.tsloadConfig()/saveConfig()getRealmForFile()- pattern matchingPriority 3: Integration Tests (Mock HTTP)
synccommand--prefer-local--prefer-remote--dry-runmodetrackcommand--pushmode with batch uploadwatchcommandstatuscommand--allflag for multiple workspaces--pullauto-pull modeProposed Structure
Mock Strategy
fsfetchMatrixClientchild_processfs.watchImplementation Order
Success Criteria
Notes