13. Test suite (unit + integration) #15

Closed
opened 2026-05-20 15:32:06 -06:00 by ppreeper · 0 comments
Owner

Description

Create a test suite using Python unittest (stdlib only) covering flag translation and Chrome integration.

Tasks

  • Unit tests for flag translation:
    • Page size mapping (A4, Letter, Legal, etc.)
    • Margin conversion (mm → inches)
    • Orientation mapping
    • DPI to scale factor
    • Viewport size parsing
    • Cookie jar parsing (Netscape → Chrome JSON)
    • Header/footer template generation
  • Integration tests (require Chrome installed):
    • Basic PDF generation from HTML
    • Page size verification in output
    • Margin verification
    • Header/footer injection
    • Multiple input file concatenation
    • Timeout handling
    • Missing file error handling
  • Test fixtures: small HTML files with known content
  • Skip integration tests if Chrome not available

Acceptance Criteria

  • python3 -m unittest discover runs all tests
  • Unit tests pass without Chrome installed
  • Integration tests pass with Chrome installed
  • All flag translation logic covered by unit tests
  • Integration tests verify actual PDF output properties

Notes

  • Python unittest only, no pytest or other frameworks
  • Test files in tests/ directory
  • Use tempfile for test output files
  • Relates to PRD #2
## Description Create a test suite using Python `unittest` (stdlib only) covering flag translation and Chrome integration. ## Tasks - [ ] **Unit tests** for flag translation: - Page size mapping (A4, Letter, Legal, etc.) - Margin conversion (mm → inches) - Orientation mapping - DPI to scale factor - Viewport size parsing - Cookie jar parsing (Netscape → Chrome JSON) - Header/footer template generation - [ ] **Integration tests** (require Chrome installed): - Basic PDF generation from HTML - Page size verification in output - Margin verification - Header/footer injection - Multiple input file concatenation - Timeout handling - Missing file error handling - [ ] Test fixtures: small HTML files with known content - [ ] Skip integration tests if Chrome not available ## Acceptance Criteria - `python3 -m unittest discover` runs all tests - Unit tests pass without Chrome installed - Integration tests pass with Chrome installed - All flag translation logic covered by unit tests - Integration tests verify actual PDF output properties ## Notes - Python `unittest` only, no pytest or other frameworks - Test files in `tests/` directory - Use `tempfile` for test output files - Relates to PRD #2
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppreeper/wkhtmltopdf#15
No description provided.