test("return a user object",()=>{expect(getUser(1)).toBe({id:1,email:`user1@test.com`,});});
$ npmtest> my-jest@1.0.0 test /my-jest
> jest
FAIL ./test.js
✕ return a user object (7ms) ● return a user object
expect(received).toBe(expected) // Object.is equality
Expected: {"email":"user1@test.com", "id":1} Received: {"email":"user1@test.com", "id":1}
Difference:
Compared values have no visual difference. Note that you are testing for equality with the stricter `toBe` matcher using `Object.is`. For deep equality only, use `toEqual` instead.
11|12| test('return a user object', ()=>{>13| expect(getUser(1)).toBe({| ^
14| id: 1,
15| email: `user1@test.com`16|}); at Object.toBe (test.js:13:22)Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 0.901s, estimated 1s
Ran all test suites.
npm ERR! Test failed. See above formore details.
test("return a user object",()=>{expect(getUser(1)).toEqual({id:1,email:`user1@test.com`,});});
$ npmtest> my-jest@1.0.0 test /my-jest
> jest
PASS ./test.js
✓ return a user object (3ms)Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.91s, estimated 1s
Ran all test suites.