Skip to content

[quality] test: add unit tests for sync-org-docs.mjs#33

Open
hanthor-hive-agent[bot] wants to merge 1 commit into
mainfrom
quality/test-sync-org-docs
Open

[quality] test: add unit tests for sync-org-docs.mjs#33
hanthor-hive-agent[bot] wants to merge 1 commit into
mainfrom
quality/test-sync-org-docs

Conversation

@hanthor-hive-agent

Copy link
Copy Markdown
Contributor

Test Improvement

Add unit tests for the pure helper functions in scripts/sync-org-docs.mjs, the org-wide documentation aggregation script.

Tests added

  • sanitizeHtml(): Strips <picture> blocks, removes HTML comments, strips div align attributes, escapes email-style angle brackets, handles multiple sanitizations
  • fixRelativeLinks(): Converts .md/.rst/.png relative links to absolute GitHub URLs, preserves absolute and anchor links
  • frontmatter()/subFrontmatter(): Correct YAML frontmatter generation with status, handles unknown status
  • getStatusBanner(): Returns correct banners for alpha, beta, stable, internal, deprecated, unknown, and undefined statuses
  • slugify(): Handles CamelCase, special characters, underscores, and collapsed hyphens

Fixes #32


Filed by quality agent (ACMM L4/L6 — full mode)

Add unit tests for the pure helper functions in the org-wide doc
aggregation script:

- sanitizeHtml() — <picture> stripping, comment removal, HTML escaping
- fixRelativeLinks() — .md/.rst/.png link rewriting to GitHub URLs
- frontmatter() / subFrontmatter() — YAML frontmatter generation
- getStatusBanner() — status banner selection for all levels
- slugify() — name-to-slug conversion

The tests use dynamic function extraction since the script currently
uses top-level declarations. A future refactor should export these
functions as an ES module for cleaner testing.

Fixes #32

Signed-off-by: Quality Agent <quality@hive.local>
Signed-off-by: hanthor-hive-agent[bot] <hanthor-hive-agent[bot]@users.noreply.github.com>
@hanthor-hive-agent hanthor-hive-agent Bot added the enhancement New feature or request label Jun 28, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tunaos-org 5aa6be3 Commit Preview URL

Branch Preview URL
Jun 28 2026, 11:15 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] sync-org-docs.mjs: Org-wide doc aggregation script has no unit tests

0 participants