Jest.js error: “Received: serializes to the same string”

Similarly to other colleagues I had this issue with an Array comparison, I was basically testing a function that got the largest string in an array, additionally it should return an array if more than 1 of those strings matched the largest length possible.

When I started testing I got the following message:

screenshot of jest results

So I replaced the toBe method

expect(function(array1)).toBe('one result')

with toStrictEqual to make a deep equality comparison

expect(function(array2)).toStrictEqual(['more than one', 'more than one']);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)