fix setting and add rental policies
Test / Type Check (all packages) (push) Has been cancelled
Test / API Unit Tests (push) Has been cancelled
Test / Homepage Unit Tests (push) Has been cancelled
Test / Carplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
Build & Push / Pipeline Tests (push) Waiting to run
Build & Push / Build & Push Docker Image (push) Blocked by required conditions

This commit is contained in:
root
2026-07-20 22:47:52 -04:00
parent d13ae2205f
commit 8f5ca1df22
24 changed files with 584 additions and 106 deletions
@@ -70,6 +70,7 @@ describe('company configuration API contracts', () => {
vi.mocked(companyService.setCustomDomain).mockResolvedValue({ id: 'brand_1', customDomain: 'cars.example.com' } as never)
vi.mocked(companyService.createInsurancePolicy).mockResolvedValue({ id: 'policy_1' } as never)
vi.mocked(companyService.createPricingRule).mockResolvedValue({ id: 'rule_1' } as never)
vi.mocked(companyService.updateContractSettings).mockResolvedValue({ id: 'contract_settings_1' } as never)
vi.mocked(companyService.updateAccountingSettings).mockResolvedValue({ id: 'accounting_1' } as never)
})
@@ -126,6 +127,25 @@ describe('company configuration API contracts', () => {
}))
})
it('passes rental policy text settings through to the service', async () => {
const res = await request(app).patch('/api/v1/companies/me/contract-settings').send({
fuelPolicy: 'Return with the same fuel level shown at pickup.',
fuelPolicyType: 'SAME_TO_SAME',
fuelPolicyNote: 'Charge refueling when fuel is lower at return.',
additionalDriverPolicy: 'Only approved additional drivers may operate the vehicle.',
damagePolicy: 'Damage is assessed at return inspection.',
})
expect(res.status).toBe(200)
expect(companyService.updateContractSettings).toHaveBeenCalledWith('company_1', {
fuelPolicy: 'Return with the same fuel level shown at pickup.',
fuelPolicyType: 'SAME_TO_SAME',
fuelPolicyNote: 'Charge refueling when fuel is lower at return.',
additionalDriverPolicy: 'Only approved additional drivers may operate the vehicle.',
damagePolicy: 'Damage is assessed at return inspection.',
})
})
it('rejects malformed pricing rules before service execution', async () => {
const res = await request(app).post('/api/v1/companies/me/pricing-rules').send({
name: 'Young driver fee',