test(dialtone-docs): DLT-3268 refactor test suite — consolidate, remove hardcoded values, add CI workflow#1183
test(dialtone-docs): DLT-3268 refactor test suite — consolidate, remove hardcoded values, add CI workflow#1183belumontoya wants to merge 2 commits intostagingfrom
Conversation
…ve hardcoded values, add CI workflow
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 👍 / 👎.
test(dialtone-docs): DLT-3268 refactor test suite
Obligatory GIF (super important!)
🛠️ Type Of Change
📖 Jira Ticket
https://dialpad.atlassian.net/browse/DLT-3268
📖 Description
Consolidates the
dialtone-docstest suite from 6 files / 45 tests down to 3 files / 29 tests, and adds a CI workflow.Files created
tests/tests/schema.test.js— Mergesfrontmatter.test.js+build-output.test.jsinto a single file with sharedALLOWED_TYPESconstant. Validates source markdown frontmatter schema (6 tests) and compiledai-docs.jsonoutput schema (11 tests).tests/tests/content-quality.test.js— Replaces hardcoded file lists with dynamic discovery. UsesreaddirSyncto discover category directories at runtime and verify each has anINDEX.md. Also validates no placeholder text (TODO/FIXME/TBD) in prose and that Handlebars templates exist insrc/templates/..github/workflows/docs_tests.yml— New CI workflow that runspnpm nx run dialtone-docs:teston PRs and pushes to staging touchingpackages/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 intoschema.test.jstests/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 intoschema.test.jstests/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-docstest suite had scaling problems:ALLOWED_TYPESduplicated — defined identically infrontmatter.test.jsandbuild-output.test.jsmarkdownParser.js(333 lines) was never imported by any testAll remaining tests now validate structure and schema only — they never break when docs content changes.
📝 Checklist
🔮 Next Steps
.claude/skills/,.claude/agents/,.claude/commands/,.claude/hooks/into the doc-sync-enforcer pipeline so skill/agent changes trigger doc updates