Skip to content

test: add unit tests for PanelRenderer module - #688

Merged
rafaelscosta merged 5 commits into
mainfrom
devops/pr-501-panel-renderer-current-20260507
May 8, 2026
Merged

test: add unit tests for PanelRenderer module#688
rafaelscosta merged 5 commits into
mainfrom
devops/pr-501-panel-renderer-current-20260507

Conversation

@rafaelscosta

@rafaelscosta rafaelscosta commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Port test: add unit tests for PanelRenderer module #501 PanelRenderer coverage onto current main in SynkraAI/aiox-core.
  • Replace the stale .aios-core import with current .aiox-core resolution from the repository root.
  • Avoid a new no-control-regex lint warning by constructing the ANSI escape regex without embedding a control character.

Validation

  • npm test -- tests/core/ui/panel-renderer.test.js --runInBand --forceExit
  • npm run lint (passes with the existing 114 warnings, 0 errors)
  • npm run typecheck
  • git diff --check origin/main...HEAD && git diff --check

Supersedes #501.

Summary by CodeRabbit

  • Tests
    • Added comprehensive test suite for panel rendering functionality, validating core rendering helpers, formatting utilities, and output behavior across various scenarios and edge cases including empty content, overlong content, missing data, and special fallback behavior across multiple rendering modes.

nikolasdehor and others added 5 commits May 7, 2026 22:23
69 tests covering:
- Module exports (BOX constants, STATUS indicators)
- Constructor and default/custom options
- Box drawing primitives (horizontalLine, topBorder, bottomBorder, separator)
- Content line rendering with ANSI-aware padding
- ANSI stripping for length calculations
- Elapsed time formatting (seconds, minutes, hours)
- Pipeline rendering (stages, progress, completion markers)
- Minimal mode panel (agent info, terminals, errors, elapsed)
- Detailed mode panel (tradeoffs, next steps, PID display, reasons)
- Edge cases: empty arrays, null agent IDs, long error truncation, terminal limits
- Move FORCE_COLOR para beforeAll/afterAll (evita leak entre workers)
- Troca \x1B por \u001B no regex (compatibilidade Biome)
- Divide teste de elapsed em 2 casos distintos (null vs 0)
- Adiciona asserção para result.story
Corrige aviso do Biome lint usando Unicode escape
consistente nas strings ANSI dos testes stripAnsi.
- Use RegExp constructor for ANSI regex (avoids Biome lint/suspicious/noControlCharactersInRegex)
- Remove duplicate null-timestamp test (lines 252-258 duplicated lines 218-224)
@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aiox-core Ready Ready Preview, Comment May 8, 2026 1:26am

Request Review

@github-actions github-actions Bot added area: agents Agent system related area: workflows Workflow system related squad mcp type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: installer Installer and setup (packages/installer/) area: synapse SYNAPSE context engine area: cli CLI tools (bin/, packages/aios-pro-cli/) area: pro Pro features (pro/) area: health-check Health check system area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels May 8, 2026
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5697509b-41ff-4259-abfb-12a47b27f73e

📥 Commits

Reviewing files that changed from the base of the PR and between a2bbcf3 and cb60a33.

📒 Files selected for processing (1)
  • tests/core/ui/panel-renderer.test.js

Walkthrough

This pull request adds a comprehensive Jest test suite for the PanelRenderer module. The suite validates constructor behavior, rendering helper functions, utility methods for ANSI stripping and elapsed time formatting, and main rendering functions (renderPipeline, renderMinimal, renderDetailed), with assertions on output structure, content truncation limits, and edge-case handling.

Changes

PanelRenderer Test Suite

Layer / File(s) Summary
Setup and Exports
tests/core/ui/panel-renderer.test.js
Test environment disables FORCE_COLOR for stable output, provides stripAnsi utility for assertions, and verifies exported symbols (PanelRenderer, BOX, STATUS constants).
Constructor Options
tests/core/ui/panel-renderer.test.js
Constructor tests validate default width, custom width acceptance, and options merging with debug flag.
Rendering Helpers
tests/core/ui/panel-renderer.test.js
Core rendering primitives (horizontalLine, topBorder, bottomBorder, separator, contentLine) are tested for correct width handling, border characters, and graceful overflow.
Utility Functions
tests/core/ui/panel-renderer.test.js
stripAnsi removes ANSI escape codes; formatElapsedTime formats elapsed duration, returning -- for missing/zero timestamps.
Main Rendering Functions
tests/core/ui/panel-renderer.test.js
renderPipeline lists stages and marks completion; renderMinimal outputs compact format with agent info and active terminals (limited to 3), errors truncated to 50 chars; renderDetailed outputs verbose format with agent details, terminals (limited to 4), trade-offs (limited to 3), next steps (limited to 3), and errors (limited to 2, truncated to 45 chars).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

type: test, area: core

Suggested reviewers

  • oalanicolas
  • Pedrovaleriolopez
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding unit tests for the PanelRenderer module, which aligns perfectly with the file additions and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devops/pr-501-panel-renderer-current-20260507

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

Coverage report not available

📈 Full coverage report available in Codecov


Generated by PR Automation (Story 6.1)

@rafaelscosta
rafaelscosta merged commit 8a8ea56 into main May 8, 2026
41 checks passed
@rafaelscosta
rafaelscosta deleted the devops/pr-501-panel-renderer-current-20260507 branch May 8, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: cli CLI tools (bin/, packages/aios-pro-cli/) area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) area: health-check Health check system area: installer Installer and setup (packages/installer/) area: pro Pro features (pro/) area: synapse SYNAPSE context engine area: workflows Workflow system related mcp squad type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants