Skip to content

Commit

Permalink
Fix supplier.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Nov 17, 2024
1 parent 392762f commit b89cc55
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions api/tests/supplier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ describe('POST /api/frontend-suppliers', () => {
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body.length).toBe(1)
payload.carSpecs!.aircon = true
payload.carSpecs!.moreThanFourDoors = true
payload.carSpecs!.moreThanFiveSeats = true
payload.seats = 6

payload.mileage = [bookcarsTypes.Mileage.Limited]
res = await request(app)
Expand Down Expand Up @@ -598,7 +602,6 @@ describe('POST /api/backend-suppliers', () => {
const token = await testHelper.signinAsAdmin()

const payload: bookcarsTypes.GetCarsPayload = {
pickupLocation: LOCATION_ID,
carType: [bookcarsTypes.CarType.Diesel, bookcarsTypes.CarType.Gasoline],
gearbox: [bookcarsTypes.GearboxType.Manual, bookcarsTypes.GearboxType.Automatic],
mileage: [bookcarsTypes.Mileage.Limited, bookcarsTypes.Mileage.Unlimited],
Expand Down Expand Up @@ -640,6 +643,10 @@ describe('POST /api/backend-suppliers', () => {
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body.length).toBeGreaterThan(0)
payload.carSpecs!.aircon = true
payload.carSpecs!.moreThanFourDoors = true
payload.carSpecs!.moreThanFiveSeats = true
payload.seats = 6

payload.mileage = [bookcarsTypes.Mileage.Limited]
res = await request(app)
Expand All @@ -649,15 +656,6 @@ describe('POST /api/backend-suppliers', () => {
expect(res.statusCode).toBe(200)
expect(res.body.length).toBeGreaterThan(0)

payload.availability = [bookcarsTypes.Availablity.Available, bookcarsTypes.Availablity.Unavailable]
res = await request(app)
.post('/api/backend-suppliers')
.set(env.X_ACCESS_TOKEN, token)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body.length).toBeGreaterThan(0)
payload.availability = undefined

payload.mileage = []
res = await request(app)
.post('/api/backend-suppliers')
Expand Down Expand Up @@ -700,6 +698,15 @@ describe('POST /api/backend-suppliers', () => {
expect(res.statusCode).toBe(200)
expect(res.body.length).toBe(0)

payload.availability = [bookcarsTypes.Availablity.Available, bookcarsTypes.Availablity.Unavailable]
res = await request(app)
.post('/api/backend-suppliers')
.set(env.X_ACCESS_TOKEN, token)
.send(payload)
expect(res.statusCode).toBe(200)
expect(res.body.length).toBeGreaterThan(0)
payload.availability = undefined

payload.availability = []
res = await request(app)
.post('/api/backend-suppliers')
Expand Down

0 comments on commit b89cc55

Please sign in to comment.