Files
ctask/internal
typebasedio 3a4a8d28f2 test(v0.3): add MostRecentActive helper with focused unit coverage
Extracts the cross-type "most recently updated active workspace"
selector that previously lived inline in cmd/last and cmd/delete.
The helper takes only a root path and returns (nil, nil) when
nothing matches, which keeps the call sites trivial.

Eight focused tests cover:
  - tasks-only fixture
  - projects-only fixture
  - project most-recent vs older task
  - task most-recent vs older project
  - legacy v0.2 workspace (no Type field) winning, treated as task
  - newest workspace archived, older active project wins
  - empty root returns (nil, nil)
  - all archived returns (nil, nil)

A new createTestWorkspaceFull helper takes an explicit UpdatedAt
timestamp so the "which is newest" assertions don't depend on
wall-clock ordering.

cmd/last and cmd/delete are migrated onto the helper in the next
commit.
2026-04-10 17:00:05 -04:00
..