Skip to content

Commit

Permalink
fix: broken download tests
Browse files Browse the repository at this point in the history
Declaring `browserslist` in package.json exposed a bug in the
download.js tests that wasn't causing failures before (but arguably,
should): one can't use arrow functions to mock constructors because
calling `new` on them doesn't work.  See the NOTE under:

https://jestjs.io/docs/es6-class-mocks#-module-factory-function-must-return-a-function
  • Loading branch information
arbrandes committed Dec 6, 2024
1 parent 40ab338 commit b171d45
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data/redux/thunkActions/download.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jest.mock('@zip.js/zip.js', () => {
close: mockZipClose.mockImplementation(() => Promise.resolve(files)),
files,
})),
BlobWriter: () => mockBlobWriter,
TextReader: () => mockTextReader,
BlobReader: () => mockBlobReader,
BlobWriter: function () { return mockBlobWriter; },
TextReader: function () { return mockTextReader; },
BlobReader: function () { return mockBlobReader; },
};
});

Expand Down

0 comments on commit b171d45

Please sign in to comment.