I have a test file and the test fails saying :
Code :
jest.mock('superstruct');
const mockDefine = jest.mocked(define);
const mockDynamicLib = jest.mocked(dynamicLib);
const mockStruct = {} as CustomAny; // this line causes error
const mockValidator = {};
const mockDynamicCb = jest.fn(() => mockValidator);
const mockValue = 'value';
const mockValues = {
field: 'fieldValue',
};
I’ve tried writing in different ways but the error doesn’t go away :
What I’ve tried :
function createMockStruct(): CustomAny {
return {} as CustomAny;
}
const mockStruct = createMockStruct();
#2 :
let mockStruct: CustomAny;
mockStruct = {};