-
Notifications
You must be signed in to change notification settings - Fork 53
Add unit tests for blog post parsing and slug generation #304
Description
Description
The blog post loading logic is a core part of the website and is responsible for parsing post metadata, deriving slugs, handling dates, filtering drafts, and preparing content for rendering.
At the moment, this behavior should be covered by unit tests to ensure that changes to blog parsing logic do not introduce regressions. This issue focuses on adding test coverage for blog post parsing and slug generation using the current testing setup in the repository.
Problem
- Blog post parsing is a core content workflow and needs reliable validation
- Slug generation behavior should be verified to prevent routing or content issues
- Metadata parsing and filtering logic can break silently without tests
- Regressions in content handling may affect rendering and discoverability of posts
Goal
Add unit tests that validate the behavior of blog post parsing and slug generation so that the content pipeline is more reliable and easier to maintain.
Scope of Work
- Identify the blog parsing utilities responsible for loading and transforming posts
- Add unit tests for blog post metadata parsing
- Add unit tests for slug generation behavior
- Verify handling of draft posts
- Verify handling of dates and sorting behavior where applicable
- Verify fallback/default behavior for missing optional fields where applicable
- Ensure tests are clear, maintainable, and aligned with the current test setup
Expected Outcome
- Blog parsing behavior is covered by unit tests
- Slug generation logic is verified and protected against regressions
- Contributors can make changes to blog utilities with more confidence
- Content-related bugs are easier to catch during development and review
Acceptance Criteria
- Unit tests are added for blog post parsing behavior
- Unit tests are added for slug generation behavior
- Tests cover expected and edge-case scenarios
- Tests run successfully with the repository’s current test tooling
- Test names and structure are clear and maintainable
Additional Context
This issue improves confidence in one of the website’s core content-handling paths and supports long-term maintainability as the blog system evolves.