Skip to content

Commit

Permalink
Update jest (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
ut5tw authored and Mav-Ivan committed Oct 29, 2024
1 parent 7a8ce17 commit 448f5ac
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"husky": "^8.0.0",
"jest": "^28.1.3",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"lint-staged": "^13.0.2",
"nodemon": "^3.1.4",
Expand Down
23 changes: 12 additions & 11 deletions src/test/integration/controllers/cooperation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,13 @@ describe('Cooperation controller', () => {
expect(response.body.count).toBe(1)
expect(Array.isArray(response.body.items)).toBe(true)
expect(response.body.items[0]).toMatchObject({
_id: testCooperation._body._id,
_id: testCooperation._body._id.toString(),
offer: {
_id: testOffer._id
_id: testOffer._id.toString()
},
initiator: testStudentUser.id,
receiver: testTutorUser._id,
initiator: testStudentUser.id.toString(),
receiver: testTutorUser._id.toString(),
additionalInfo: testCooperationData.additionalInfo,
proficiencyLevel: testCooperationData.proficiencyLevel,
price: testCooperationData.price,
title: testCooperationData.title,
Expand All @@ -298,10 +299,10 @@ describe('Cooperation controller', () => {

expect(response.status).toBe(200)
expect(response.body).toMatchObject({
_id: testCooperation._body._id,
_id: testCooperation._body._id.toString(),
offer: {
_id: testOffer._id,
author: testOffer.author
_id: testOffer._id.toString(),
author: { _id: testOffer.author.toString() }
},
initiator: {
...testInitiator,
Expand All @@ -310,7 +311,7 @@ describe('Cooperation controller', () => {
lastLogin: expect.any(String),
_id: expect.any(String)
},
receiver: testTutorUser._id,
receiver: testTutorUser._id.toString(),
receiverRole: tutorUserData.role[0],
proficiencyLevel: testCooperationData.proficiencyLevel,
price: testCooperationData.price,
Expand Down Expand Up @@ -366,10 +367,10 @@ describe('Cooperation controller', () => {
it('should create new cooperation', () => {
expect(testCooperation.status).toBe(201)
expect(testCooperation.body).toMatchObject({
_id: testCooperation._body._id,
offer: testOffer._id,
_id: testCooperation._body._id.toString(),
offer: testOffer._id.toString(),
initiator: testStudentUser.id,
receiver: testTutorUser._id,
receiver: testTutorUser._id.toString(),
receiverRole: tutorUserData.role[0],
proficiencyLevel: testCooperationData.proficiencyLevel,
price: testCooperationData.price,
Expand Down
4 changes: 2 additions & 2 deletions src/test/integration/controllers/finishedQuiz.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Quiz controller', () => {
let app, server, accessToken, currentUser, testFinishedQuiz, testQuiz

beforeAll(async () => {
; ({ app, server } = await serverInit())
;({ app, server } = await serverInit())
})

beforeEach(async () => {
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Quiz controller', () => {
_id: expect.any(String),
createdAt: expect.any(String),
updatedAt: expect.any(String),
quiz: testQuiz._id,
quiz: testQuiz._id.toString(),
...testFinishedQuizData
})
})
Expand Down
6 changes: 3 additions & 3 deletions src/test/integration/controllers/note.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Note controller', () => {
let app, server, accessToken, testUser, testCooperation, testNote

beforeAll(async () => {
; ({ app, server } = await serverInit())
;({ app, server } = await serverInit())
})

beforeEach(async () => {
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('Note controller', () => {
firstName: expect.any(String),
lastName: expect.any(String)
},
cooperation: testCooperation._id,
cooperation: testCooperation._id.toString(),
createdAt: expect.any(String),
updatedAt: expect.any(String)
})
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('Note controller', () => {
_id: testNote._body._id,
text: expect.any(String),
author: testUser.id,
cooperation: testCooperation._id,
cooperation: testCooperation._id.toString(),
createdAt: expect.any(String),
updatedAt: expect.any(String)
})
Expand Down
4 changes: 2 additions & 2 deletions src/test/integration/controllers/notification.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Notification controller', () => {
let app, server, accessToken, currentUser, testNotification

beforeAll(async () => {
; ({ app, server } = await serverInit())
;({ app, server } = await serverInit())
})

beforeEach(async () => {
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('Notification controller', () => {
expect(response.statusCode).toBe(200)
expect(response.body.count).toBe(1)
expect(response.body.items[0]).toMatchObject({
_id: testNotification._id,
_id: testNotification._id.toString(),
createdAt: expect.any(String),
updatedAt: expect.any(String),
...testNotificationData
Expand Down

0 comments on commit 448f5ac

Please sign in to comment.