It fails cause x and y are different instances and not equal as in (x === y) === false. You can use toBe for primitives like strings, numbers or booleans for everything else use toEqual. For example
x = 4
y = 4
x === y // true
x = 'someString'
y = 'someString'
x === y // true
Even empty objects are not equal
x = {}
y = {}
x === y //false