From b171d45af7968ea07a4a81ebe7a9777b2ce45593 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Fri, 6 Dec 2024 09:28:25 -0300 Subject: [PATCH] fix: broken download tests 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 --- src/data/redux/thunkActions/download.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/redux/thunkActions/download.test.js b/src/data/redux/thunkActions/download.test.js index c94e306a..0cb59138 100644 --- a/src/data/redux/thunkActions/download.test.js +++ b/src/data/redux/thunkActions/download.test.js @@ -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; }, }; });