fix(budget): name the category parking and file parking bookings in it

The key was 'parkings', which is not a word and does not match the 'parking'
the reservation type uses everywhere else. The shared trip page prints the
stored category verbatim, so a share link would have shown "parkings" in every
language.

The category also had no relationship to the booking type of the same name:
RESERVATION_TYPE_TO_COST_CATEGORY still sent a parking booking's auto-expense
to Transport, so the new bucket sat empty next to the costs that belong in it
while a manually typed "parking" resolved into it. Both paths agree now.
This commit is contained in:
Maurice Böe
2026-08-21 14:14:23 +02:00
committed by Maurice
parent 999236f944
commit 942e1932c9
27 changed files with 53 additions and 35 deletions
+14 -2
View File
@@ -4,6 +4,7 @@ import {
budgetToggleMemberPaidRequestSchema,
budgetReorderItemsRequestSchema,
COST_CATEGORIES,
typeToCostCategory,
} from './budget.schema';
import { describe, it, expect } from 'vitest';
@@ -44,8 +45,19 @@ describe('budgetReorderItemsRequestSchema', () => {
});
describe('COST_CATEGORIES', () => {
it('includes fuel and parkings alongside the existing fixed categories', () => {
it('includes fuel and parking alongside the existing fixed categories', () => {
expect(COST_CATEGORIES).toContain('fuel');
expect(COST_CATEGORIES).toContain('parkings');
expect(COST_CATEGORIES).toContain('parking');
});
});
describe('typeToCostCategory', () => {
it('files a parking booking under parking, not transport', () => {
expect(typeToCostCategory('parking')).toBe('parking');
});
it('leaves the other vehicle types on transport', () => {
expect(typeToCostCategory('car-rental')).toBe('transport');
expect(typeToCostCategory('taxi')).toBe('transport');
});
});
+2 -2
View File
@@ -47,7 +47,7 @@ export const COST_CATEGORIES = [
'health',
'tips',
'fuel',
'parkings',
'parking',
'other',
] as const;
export type CostCategory = (typeof COST_CATEGORIES)[number];
@@ -72,7 +72,7 @@ const RESERVATION_TYPE_TO_COST_CATEGORY: Record<string, CostCategory> = {
hotel: 'accommodation',
accommodation: 'accommodation',
lodging: 'accommodation',
parking: 'transport',
parking: 'parking',
restaurant: 'food',
activity: 'activities',
};