Skip to content

test(dialtone-docs): DLT-3268 refactor test suite — consolidate, remove hardcoded values, add CI workflow#1183

Open
belumontoya wants to merge 2 commits intostagingfrom
feature/DLT-3268-docs-test-refactor
Open

test(dialtone-docs): DLT-3268 refactor test suite — consolidate, remove hardcoded values, add CI workflow#1183
belumontoya wants to merge 2 commits intostagingfrom
feature/DLT-3268-docs-test-refactor

Conversation

@belumontoya
Copy link
Copy Markdown
Collaborator

test(dialtone-docs): DLT-3268 refactor test suite

Obligatory GIF (super important!)

Obligatory GIF

🛠️ Type Of Change

  • Test

📖 Jira Ticket

https://dialpad.atlassian.net/browse/DLT-3268

📖 Description

Consolidates the dialtone-docs test suite from 6 files / 45 tests down to 3 files / 29 tests, and adds a CI workflow.

Files created

  • tests/tests/schema.test.js — Merges frontmatter.test.js + build-output.test.js into a single file with shared ALLOWED_TYPES constant. Validates source markdown frontmatter schema (6 tests) and compiled ai-docs.json output schema (11 tests).
  • tests/tests/content-quality.test.js — Replaces hardcoded file lists with dynamic discovery. Uses readdirSync to discover category directories at runtime and verify each has an INDEX.md. Also validates no placeholder text (TODO/FIXME/TBD) in prose and that Handlebars templates exist in src/templates/.
  • .github/workflows/docs_tests.yml — New CI workflow that runs pnpm nx run dialtone-docs:test on PRs and pushes to staging touching packages/dialtone-docs/**.

Files deleted

  • tests/tests/completeness.test.js — Hardcoded file lists per category (broke every time a doc was added/removed)
  • tests/tests/frontmatter.test.js — Merged into schema.test.js
  • tests/tests/searchability.test.js — Hardcoded content term assertions (not structural)
  • tests/tests/structure.test.js — Config file existence checks (near-zero value)
  • tests/tests/build-output.test.js — Merged into schema.test.js
  • tests/helpers/markdownParser.js — 333 lines of unused helper code (never imported by any test)

Unchanged

  • tests/tests/strip-markdown.test.js — 8 unit tests, untouched

💡 Context

The dialtone-docs test suite had scaling problems:

  • Hardcoded file lists — tests listed every doc filename per category, requiring manual updates whenever a doc was added or removed
  • ALLOWED_TYPES duplicated — defined identically in frontmatter.test.js and build-output.test.js
  • Content assertions — tests checked that specific package names and technical terms appeared somewhere in the docs (not structural)
  • Dead codemarkdownParser.js (333 lines) was never imported by any test
  • No CI — tests only ran on command, not on PRs

All remaining tests now validate structure and schema only — they never break when docs content changes.

📝 Checklist

  • I have ensured no private Dialpad links or info are in the code or pull request description (Dialtone is a public repo!).
  • I have reviewed my changes.
  • I have added all relevant documentation.
  • I have considered the performance impact of my change.
  • I have added / updated unit tests.

🔮 Next Steps

  • Wire .claude/skills/, .claude/agents/, .claude/commands/, .claude/hooks/ into the doc-sync-enforcer pipeline so skill/agent changes trigger doc updates

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27920e2bcb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

keywords: Array.isArray(frontmatter.keywords) ? frontmatter.keywords : [],
summary: frontmatter.ai_summary ?? null,
content,
lastUpdated: frontmatter.last_updated ? String(frontmatter.last_updated) : null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve YYYY-MM-DD when serializing lastUpdated

gray-matter (via YAML parsing) materializes unquoted dates like 2026-03-04 as Date objects, so String(frontmatter.last_updated) emits a locale/timezone-dependent value (e.g., Wed Mar 04 2026 ...) instead of the documented YYYY-MM-DD schema. This makes ai-docs.json nondeterministic across environments and can break downstream consumers that expect normalized date strings; serialize to an explicit date format (or preserve the original scalar text) before writing lastUpdated.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant