Testing anonymous function equality with Jest
问题 Is there a way to test anonymous function equality with jest@20 ? I am trying to pass a test similar to: const foo = i => j => {return i*j} const bar = () => {baz:foo(2), boz:1} describe('Test anonymous function equality',()=>{ it('+++ foo', () => { const obj = foo(2) expect(obj).toBe(foo(2)) }); it('+++ bar', () => { const obj = bar() expect(obj).toEqual({baz:foo(2), boz:1}) }); }); which currently yields: ● >>>Test anonymous function equality › +++ foo expect(received).toBe(expected)