Skip to content

Make the tests check what they claim (land #78 on master) - #79

Merged
alekswebnet merged 1 commit into
masterfrom
fix/vacuous-tests
Nov 7, 2026
Merged

alekswebnet merged 1 commit into
masterfrom
fix/vacuous-tests

Conversation

@alekswebnet

Copy link
Copy Markdown
Collaborator

Summary

#78 merged into chore/pdfjs-6.5.438, but #77 had already merged that branch into master. The commit therefore never reached master, and #76 is still open. This PR brings the same commit, b582384, to master unchanged. The full description and review are on #78.

Closes #76.

The commit fixes four tests that passed whether or not their feature worked:

  • should render the PDF file now opens a PDF the repository tracks and waits until a page is drawn.
  • should not render PDF with wrong url now waits for documenterror and fails if pages load instead.
  • should open the external file with base64 source now opens { data } and checks for the document's own text.
  • defaults to resources that ship next to the runtime files now checks that the response isn't the dev server's HTML page.

It also removes the missing PDF from 14 tests that don't need a document. It drops Uint8Array from PdfViewerApplicationOpenParameters, because PDF.js 6 rejects it at runtime.

Validation

Checklist

  • The change is focused and includes tests for behavior changes.
  • Relevant tests and the build pass locally.
  • Public API, behavior, or user-guidance documentation is updated where needed. The type now matches the docs, which already use open({ data }).
  • Accessibility impact has been considered, including keyboard navigation and focus visibility. There are no UI changes.
  • This pull request does not disclose a security vulnerability.

🤖 Generated with Claude Code

Several tests passed whether or not the feature worked (#76):

- "should render the PDF file" opened a PDF that exists nowhere and
  asserted inside a handler it never awaited. It now opens a PDF in
  the repository and waits for a page to be drawn.
- "should not render PDF with wrong url" asserted before the load could
  finish. It now waits for the load to fail, and fails if pages load.
- "should open the external file with base64 source": getFileData()
  fetched the base64 string as a relative URL, and PDF.js 6 rejects a
  bare Uint8Array. It now opens { data } and checks the document's text.
- "defaults to resources that ship next to the runtime files" checked
  HEAD for a 200, which the dev server also returns for a missing file.
  It now checks the content type.
- 14 tests set src to a missing PDF they didn't need; that's removed.

PdfViewerApplicationOpenParameters no longer allows a bare Uint8Array,
which PDF.js rejects at runtime.

Closes #76

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alekswebnet
alekswebnet merged commit 81d9fab into master Nov 7, 2026
7 checks passed
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.

[Bug]: Several browser tests pass without testing anything

1 participant