Failing jest test when Expected & Received are the same

Viewed 80

I'm running into a simple but annoying issue that I feel like I just don't understand how Jest parses and compares results.

it('should throw error when file is encrypted', async () => {
  const uint8 = fs.readFileSync('file');
  await expect(loadingFile(uint8Array)).rejects.toThrow(TypeError);
});

This test fails & in the terminal I see:

Expected constructor: TypeError
Received constructor: TypeError

typeof(error) on the error itself is an object.

How can I debug this?

0 Answers
Related