Skip to content

test(frontend): add snapshot tests for PDF reports (#54) - #443

Open
Owolabenjade wants to merge 11 commits into
harystyleseze:mainfrom
Owolabenjade:test/pdf-report-snapshots
Open

test(frontend): add snapshot tests for PDF reports (#54)#443
Owolabenjade wants to merge 11 commits into
harystyleseze:mainfrom
Owolabenjade:test/pdf-report-snapshots

Conversation

@Owolabenjade

Copy link
Copy Markdown
Contributor

Closes #54

What changed

  • PDF Snapshot Tests: Added dashboard/src/app/pdf.test.ts to render production PDFs, intercept downloads via subclass mock wrapping, and parse the output text structure using pdf-parse.
  • Text Anchors & Page Count Assertions: Confirmed that the extracted text contains all necessary anchors (header titles, prices, line items, and medications) and asserted correct page counts.
  • Vite/Vitest Config: Configured vitest.config.ts to include the PDF tests and run them under the node environment (preventing test timeouts under jsdom's worker scheduling).
  • FS Interceptors: Monkeypatched fs.readFileSync for 05-versions-space.pdf to redirect it to the actual file within node_modules during import, allowing the pdf-parse synchronous self-test to pass.
  • Regeneration Runbook: Added docs/runbooks/pdf-regenerate-snapshots.md explaining how to update PDF snapshots.

How to test

Run the PDF snapshot test suite:

npx vitest run pdf.test.ts

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Owolabenjade is attempting to deploy a commit to the Harrison Eze's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Owolabenjade Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Owolabenjade
Owolabenjade force-pushed the test/pdf-report-snapshots branch from df57317 to 165d27f Compare June 27, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshot tests for PDF reports — lock output formatting

1 participant