Skip to content

Instantly share code, notes, and snippets.

@gabizinha12
Last active Apr 2, 2021
Embed
What would you like to do?
$ yarn test
yarn run v1.22.5
$ jest
FAIL src/__tests__/likes.spec.js
● Likes › should be able to give a like to the repository
expect(received).toMatchObject(expected)
Matcher error: received value must be a non-null object
Received has type: number
Received has value: 1
16 | );
17 |
> 18 | expect(response.body).toMatchObject({
| ^
19 | likes: 1
20 | });
21 |
at Object.<anonymous> (src/__tests__/likes.spec.js:18:27)
FAIL src/__tests__/projects.spec.js
● Projects › should be able to update repository
expect(received).toBe(expected) // Object.is equality
Expected: true
Received: false
79 | });
80 |
> 81 | expect(isUuid(response.body.id)).toBe(true);
| ^
82 |
83 | expect(response.body).toMatchObject({
84 | url: "https://github.com/Rocketseat/unform",
at Object.<anonymous> (src/__tests__/projects.spec.js:81:38)
● Projects › should not be able to update a non existing repository
expected 404 "Not Found", got 500 "Internal Server Error"
91 | await request(app)
92 | .put(`/repositories/123`)
> 93 | .expect(404);
| ^
94 | });
95 |
96 | it("should not be able to update repository likes manually", async () => {
at Object.<anonymous> (src/__tests__/projects.spec.js:93:8) ----
at Test.Object.<anonymous>.Test._assertStatus (node_modules/supertest/lib/test.js:296:12)
at node_modules/supertest/lib/test.js:80:15
at Test.Object.<anonymous>.Test._assertFunction (node_modules/supertest/lib/test.js:311:11)
at Test.Object.<anonymous>.Test.assert (node_modules/supertest/lib/test.js:201:21)
at Server.localAssert (node_modules/supertest/lib/test.js:159:12)
● Projects › should not be able to update repository likes manually
expect(received).toMatchObject(expected)
- Expected - 3
+ Received + 1
- Object {
- "likes": 0,
- }
+ Object {}
109 | });
110 |
> 111 | expect(response.body).toMatchObject({
| ^
112 | likes: 0
113 | });
114 | });
at Object.<anonymous> (src/__tests__/projects.spec.js:111:27)
Test Suites: 2 failed, 2 total
Tests: 4 failed, 5 passed, 9 total
Snapshots: 0 total
Time: 5.272 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation
about this command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment