What changes are you proposing?
Add automated unit tests for the blog post composition script (scripts/compose.ts) to cover its interactive CLI flow and file generation behavior.
Why do we need this improvement?
The compose script is frequently used by contributors to create new blog posts, but it currently has no automated coverage.
Problems now:
- No tests for the CLI flow.
- Manual validation required for any change.
- Risk of regressions in slug generation, front matter output, and file writing.
How will this change help?
- Safer refactoring of the script.
- Faster contributor feedback via
npm test.
- Ensures consistent output (front matter + slug + file path).
How could it be implemented/designed?
Implementation plan:
Add tests/scripts/compose.test.ts using Jest (already configured with asyncapi/website).
Mock dependencies:
inquirer for CLI answers.
fs for file writes.
moment for deterministic dates.
Test scenarios:
- Happy path: verify file path + front matter.
- Slug generation: ensure titles convert to kebab-case.
- Error handling: verify logging on file write failure.
Breaking changes
No.
Check Before Submitting
Would you like to help fix this issue? (Not required, but appreciated!)
cc @asyncapi/maintainers
What changes are you proposing?
Add automated unit tests for the blog post composition script (
scripts/compose.ts) to cover its interactive CLI flow and file generation behavior.Why do we need this improvement?
The
composescript is frequently used by contributors to create new blog posts, but it currently has no automated coverage.Problems now:
How will this change help?
npm test.How could it be implemented/designed?
Implementation plan:
Add
tests/scripts/compose.test.tsusing Jest (already configured with asyncapi/website).Mock dependencies:
inquirerfor CLI answers.fsfor file writes.momentfor deterministic dates.Test scenarios:
Breaking changes
No.
Check Before Submitting
Would you like to help fix this issue? (Not required, but appreciated!)
cc @asyncapi/maintainers