fix test issues
Build & Deploy / Build & Push Docker Image (push) Successful in 3m1s
Test / Type Check (all packages) (push) Successful in 55s
Build & Deploy / Deploy to VPS (push) Successful in 5s
Test / API Unit Tests (push) Successful in 47s
Test / Homepage Unit Tests (push) Successful in 42s
Test / Carplace Unit Tests (push) Successful in 42s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 41s
Test / API Integration Tests (push) Successful in 1m0s
Build & Deploy / Build & Push Docker Image (push) Successful in 3m1s
Test / Type Check (all packages) (push) Successful in 55s
Build & Deploy / Deploy to VPS (push) Successful in 5s
Test / API Unit Tests (push) Successful in 47s
Test / Homepage Unit Tests (push) Successful in 42s
Test / Carplace Unit Tests (push) Successful in 42s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 41s
Test / API Integration Tests (push) Successful in 1m0s
This commit is contained in:
@@ -52,7 +52,10 @@ describe('carplace.repo public query and write boundaries', () => {
|
||||
where: {
|
||||
id: 'vehicle_1',
|
||||
isPublished: true,
|
||||
company: { slug: 'atlas', status: { in: ['ACTIVE', 'TRIALING'] } },
|
||||
company: {
|
||||
OR: [{ slug: 'atlas' }, { brand: { subdomain: 'atlas' } }],
|
||||
status: { in: ['ACTIVE', 'TRIALING'] },
|
||||
},
|
||||
},
|
||||
include: { company: { include: { brand: true } } },
|
||||
})
|
||||
|
||||
@@ -44,6 +44,7 @@ vi.mock('../../modules/carplace/carplace.service', () => ({
|
||||
getCities: vi.fn(),
|
||||
getListedCompanies: vi.fn(),
|
||||
searchVehicles: vi.fn(),
|
||||
searchVehiclesPage: vi.fn(),
|
||||
getVehicleDetail: vi.fn(),
|
||||
createCarplaceReservation: vi.fn(),
|
||||
getCompanyPage: vi.fn(),
|
||||
@@ -73,7 +74,11 @@ describe('employee, notification, and carplace API validation contracts', () =>
|
||||
vi.mocked(employeeService.updateLanguage).mockResolvedValue({ language: 'ar' } as never)
|
||||
vi.mocked(employeeService.resetPassword).mockResolvedValue({ message: 'Password updated successfully. You can now sign in.' } as never)
|
||||
vi.mocked(notificationService.setPreferences).mockResolvedValue({ success: true } as never)
|
||||
vi.mocked(carplaceService.searchVehicles).mockResolvedValue({ companies: [], vehicles: [], pagination: { page: 1, pageSize: 20, total: 0 } } as never)
|
||||
vi.mocked(carplaceService.searchVehiclesPage).mockResolvedValue({
|
||||
items: [],
|
||||
pagination: { page: 1, pageSize: 20, totalItems: 0, totalPages: 0 },
|
||||
facets: { categories: [], transmissions: [], makes: [], price: { min: null, max: null } },
|
||||
} as never)
|
||||
vi.mocked(carplaceService.submitReview).mockResolvedValue({ id: 'review_1' } as never)
|
||||
})
|
||||
|
||||
@@ -114,11 +119,12 @@ describe('employee, notification, and carplace API validation contracts', () =>
|
||||
const res = await request(app).get('/api/v1/carplace/search?city=Casablanca')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(carplaceService.searchVehicles).toHaveBeenCalledWith(expect.objectContaining({
|
||||
expect(carplaceService.searchVehiclesPage).toHaveBeenCalledWith(expect.objectContaining({
|
||||
city: 'Casablanca',
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
}))
|
||||
expect(res.body.data.pagination).toEqual({ page: 1, pageSize: 20, totalItems: 0, totalPages: 0 })
|
||||
})
|
||||
|
||||
it('rejects out-of-range public review ratings before service execution', async () => {
|
||||
|
||||
@@ -35,6 +35,7 @@ vi.mock('../../modules/carplace/carplace.service', () => ({
|
||||
getCities: vi.fn(),
|
||||
getListedCompanies: vi.fn(),
|
||||
searchVehicles: vi.fn(),
|
||||
searchVehiclesPage: vi.fn(),
|
||||
createCarplaceReservation: vi.fn(),
|
||||
getReviewContext: vi.fn(),
|
||||
submitReview: vi.fn(),
|
||||
@@ -59,7 +60,11 @@ describe('public validation API contracts', () => {
|
||||
vi.mocked(siteService.checkAvailability).mockResolvedValue({ available: true, nextAvailableAt: null } as never)
|
||||
vi.mocked(siteService.initPayment).mockResolvedValue({ checkoutUrl: 'https://pay.example.test' } as never)
|
||||
vi.mocked(siteService.handleContact).mockResolvedValue({ success: true } as never)
|
||||
vi.mocked(carplaceService.searchVehicles).mockResolvedValue({ data: [], pagination: { page: 1, pageSize: 20 } } as never)
|
||||
vi.mocked(carplaceService.searchVehiclesPage).mockResolvedValue({
|
||||
items: [],
|
||||
pagination: { page: 2, pageSize: 30, totalItems: 0, totalPages: 0 },
|
||||
facets: { categories: [], transmissions: [], makes: [], price: { min: null, max: null } },
|
||||
} as never)
|
||||
vi.mocked(carplaceService.createCarplaceReservation).mockResolvedValue({ id: 'reservation_1' } as never)
|
||||
vi.mocked(carplaceService.submitReview).mockResolvedValue({ id: 'review_1' } as never)
|
||||
})
|
||||
@@ -124,19 +129,20 @@ describe('public validation API contracts', () => {
|
||||
const res = await request(app).get('/api/v1/carplace/search?city=Rabat&maxPrice=500&page=2&pageSize=30')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(carplaceService.searchVehicles).toHaveBeenCalledWith({
|
||||
expect(carplaceService.searchVehiclesPage).toHaveBeenCalledWith({
|
||||
city: 'Rabat',
|
||||
maxPrice: 500,
|
||||
page: 2,
|
||||
pageSize: 30,
|
||||
})
|
||||
expect(res.body.data.pagination).toEqual({ page: 2, pageSize: 30, totalItems: 0, totalPages: 0 })
|
||||
})
|
||||
|
||||
it('rejects oversized carplace pagination before search execution', async () => {
|
||||
const res = await request(app).get('/api/v1/carplace/search?pageSize=500')
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
expect(carplaceService.searchVehicles).not.toHaveBeenCalled()
|
||||
expect(carplaceService.searchVehiclesPage).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects carplace reservations with invalid public contact data before service execution', async () => {
|
||||
|
||||
Reference in New Issue
Block a user