feat: adopt strict TDD framework and add adversarial test suite
- Update AGENTS.md and .agents/rules/blog-system.md with strict TDD mandate - Extract Eleventy custom filters into modular src/_filters/index.js for unit testing - Add npm test script using Node.js native test runner (node:test) - Create test/site-config.test.js for environment validation and fatal error assertions - Create test/filters.test.js for adversarial filter edge cases (dates, limits, reading time, headings) - Create test/frontmatter-schema.test.js enforcing post metadata contracts - Create test/design-rules.test.js enforcing strict anti-patterns (no glassmorphism, no shadows, max 4px radius) - Create test/build-integrity.test.js checking static output, zero 404 links, and TOC anchor targets
This commit is contained in:
@@ -30,6 +30,16 @@ Every component, style, and layout change must strictly adhere to [`sample-desig
|
||||
- **Interactivity:** Instant binary hover state transitions (no 300ms easing); high-contrast 1px/2px focus outlines for keyboard navigation.
|
||||
- **Typography:** IBM Plex Mono / JetBrains Mono for UI elements and code blocks; Inter for body prose.
|
||||
|
||||
### 1.4 Strict Test-Driven Development (TDD) & Adversarial Verification Mandate
|
||||
- **Test-First Development:** For all new features, custom filters, template helpers, frontmatter schemas, or configuration changes, write automated tests asserting expected behaviors and edge cases *before* or alongside implementing the code.
|
||||
- **Adversarial Mindset:** Actively design tests to break assumptions:
|
||||
- Missing environment variables (e.g. unset `SITE_DOMAIN` must throw).
|
||||
- Malformed frontmatter (missing titles, invalid dates, empty tags).
|
||||
- Edge-case inputs to filters (empty strings, giant numbers, special characters).
|
||||
- Design rule violations (asserting 0 instances of `backdrop-filter`, `box-shadow`, gradients, or floaty animations).
|
||||
- Broken internal links and missing anchor tags in generated HTML.
|
||||
- **Verification Gate:** Every code change must be verified by running `npm test`. No feature or commit is considered complete unless 100% of the test suite passes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Code Modularity & Isolation Guidelines
|
||||
|
||||
Reference in New Issue
Block a user