Skip to content

Commit

Permalink
Update car.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Nov 17, 2024
1 parent e0e4657 commit af2f361
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions api/tests/car.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,43 @@ describe('POST /api/cars/:page/:size', () => {
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)

payload.rating = undefined
payload.ranges = undefined
payload.multimedia = undefined
payload.fuelPolicy = undefined
payload.carSpecs!.aircon = undefined
payload.carSpecs!.moreThanFourDoors = undefined
payload.carSpecs!.moreThanFiveSeats = undefined
payload.seats = -1
res = await request(app)
.post(`/api/cars/${testHelper.PAGE}/${testHelper.SIZE}`)
.set(env.X_ACCESS_TOKEN, token)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)
payload.rating = 4
payload.ranges = [
bookcarsTypes.CarRange.Mini,
bookcarsTypes.CarRange.Midi,
bookcarsTypes.CarRange.Maxi,
bookcarsTypes.CarRange.Scooter,
]
payload.multimedia = [bookcarsTypes.CarMultimedia.AndroidAuto]
payload.fuelPolicy = [bookcarsTypes.FuelPolicy.LikeForLike]

payload.seats = undefined
payload.carSpecs = undefined
res = await request(app)
.post(`/api/cars/${testHelper.PAGE}/${testHelper.SIZE}`)
.set(env.X_ACCESS_TOKEN, token)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)
payload.carSpecs = {}
payload.carSpecs!.aircon = true
payload.carSpecs!.moreThanFourDoors = true
payload.carSpecs!.moreThanFiveSeats = true

payload.seats = 5
res = await request(app)
.post(`/api/cars/${testHelper.PAGE}/${testHelper.SIZE}`)
Expand Down Expand Up @@ -608,6 +645,41 @@ describe('POST /api/frontend-cars/:page/:size', () => {
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)

payload.rating = undefined
payload.ranges = undefined
payload.multimedia = undefined
payload.fuelPolicy = undefined
payload.carSpecs!.aircon = undefined
payload.carSpecs!.moreThanFourDoors = undefined
payload.carSpecs!.moreThanFiveSeats = undefined
payload.seats = -1
res = await request(app)
.post(`/api/frontend-cars/${testHelper.PAGE}/${testHelper.SIZE}`)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)
payload.rating = 4
payload.ranges = [
bookcarsTypes.CarRange.Mini,
bookcarsTypes.CarRange.Midi,
bookcarsTypes.CarRange.Maxi,
bookcarsTypes.CarRange.Scooter,
]
payload.multimedia = [bookcarsTypes.CarMultimedia.AndroidAuto]
payload.fuelPolicy = [bookcarsTypes.FuelPolicy.LikeForLike]

payload.seats = undefined
payload.carSpecs = undefined
res = await request(app)
.post(`/api/frontend-cars/${testHelper.PAGE}/${testHelper.SIZE}`)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body[0].resultData.length).toBeGreaterThan(0)
payload.carSpecs = {}
payload.carSpecs.aircon = true
payload.carSpecs.moreThanFourDoors = true
payload.carSpecs.moreThanFiveSeats = true

payload.seats = 5
res = await request(app)
.post(`/api/frontend-cars/${testHelper.PAGE}/${testHelper.SIZE}`)
Expand Down

0 comments on commit af2f361

Please sign in to comment.