I am trying to mock the file-type library in a jest test. In my javascript file, I use this library in the following way:
import * as fileType from 'file-type';
....
const uploadedFileType = fileType(intArray);
Then, in my jest test, I am doing:
jest.mock('file-type');
import * as fileType from 'file-type';
and then trying to mock out the response in the following way:
fileType = jest.fn();
fileType.mockReturnValue({ ext: 'jpg' });
However, I get the error "fileType" is read-only.
Does anyone have an idea as to what I'm doing wrong? Thanks in advance.