Commit 922d6efd authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Remove `PDFViewerApplication` global field after test

The tests crashed if either of these commands was executed:

- `yarn test --grep anchoring`, or
- `yarn test --grep 'anchoring/test/pdf|test/integration/anchoring'`

`src/anotator/anchoring/test/pdf-test.js` cleanup the Viewer by setting
the `window.PDFViewerApplication' to `null`. After that, if another test
created a `Guest` instance (like
`src/annotator/test/integration/anchoring-test.js`) will think that the
document is a PDF and will crash. This is the code that checks if the
document is a PDF:

https://github.com/hypothesis/client/blob/492ab6d56a5685356ca6b3a48644e047bb28dca0/src/annotator/integrations/pdf.js#L53-L56

The solution is either deleting `window.PDFViewerApplication' or setting
it to `undefined`.
parent 0c0a639b
......@@ -75,7 +75,7 @@ describe('annotator/anchoring/pdf', () => {
/** Clean up any resources created by the fake PDF.js viewer. */
function cleanupViewer() {
viewer?.dispose();
window.PDFViewerApplication = null;
delete window.PDFViewerApplication;
}
beforeEach(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment