jest-extended icon indicating copy to clipboard operation
jest-extended copied to clipboard

`toHaveBeenCalledOnceWith` does not work with Symbols

Open aduponchel opened this issue 2 years ago • 1 comments

const fn = jest.fn();
const symbol = Symbol('foo');

fn(symbol);

expect(fn).toHaveBeenCalledWith(symbol); // jest : right
expect(fn).toHaveBeenCalledWith(Symbol('foo')); // jest : wrong

expect(fn).toHaveBeenCalledOnceWith(symbol); // jest-extended : right
expect(fn).toHaveBeenCalledOnceWith(Symbol('foo')); // jest-extended : right (but should be wrong)

aduponchel avatar Nov 24 '22 13:11 aduponchel

@aduponchel I tried to reproduce the same scenario in this project: https://github.com/verdecchia/jest-extended-symbols-532

expect(fn).toHaveBeenCalledWith(Symbol('foo'));

and

expect(fn).toHaveBeenCalledOnceWith(Symbol('foo'));

both fail but with different error messages.

verdecchia avatar Jan 10 '23 18:01 verdecchia