Commit 7ac6c54
committed
test(cli): add unit tests for useChatMessages hook logic
Rewrites tests to properly test the hook logic following code review feedback:
- Tests collapse toggle transformation for agent messages (isCollapsed, userOpened)
- Tests integration with actual block-tree-utils (updateBlockById, toggleBlockCollapse)
- Tests nested block collapse traversal
- Tests pagination logic (MESSAGE_BATCH_SIZE=15, visible slice, hidden count)
- Tests integration scenarios and edge cases
Note: Uses logic simulation approach since renderHook() is unreliable
with Bun + React 19 (per cli/knowledge.md). The block tree utilities
are tested separately in block-tree-utils.test.ts.
37 tests, all passing.1 parent 8b7566b commit 7ac6c54
1 file changed
+585
-0
lines changed
0 commit comments