Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(shared): cover the stored Costs category and the hint the MCP reads

Maurice9f5d01ee099d
diff --git a/shared/src/budget/cost-category.spec.ts b/shared/src/budget/cost-category.spec.ts
index 72740a1b3..95c5e7bbf 100644
--- a/shared/src/budget/cost-category.spec.ts
+++ b/shared/src/budget/cost-category.spec.ts
@@ -1,5 +1,5 @@
-// COST-CATEGORY-001 to COST-CATEGORY-003: a typed category read as one of the fixed keys.
-import { costCategoryOf } from './cost-category';
+// COST-CATEGORY-001 to COST-CATEGORY-005: a typed category read as one of the fixed keys.
+import { COST_CATEGORY_HINT, costCategoryOf, storedCostCategory } from './cost-category';
import { describe, expect, it } from 'vitest';
@@ -23,4 +23,18 @@ describe('costCategoryOf', () => {
expect(costCategoryOf(null)).toBeNull();
expect(costCategoryOf(undefined)).toBeNull();
});
+
+ it('COST-CATEGORY-004: an expense is stored under the key, other text as given, nothing as other', () => {
+ expect(storedCostCategory('Food')).toBe('food');
+ expect(storedCostCategory('Train')).toBe('transport');
+ expect(storedCostCategory('Comida')).toBe('Comida');
+ expect(storedCostCategory('')).toBe('other');
+ expect(storedCostCategory(null)).toBe('other');
+ expect(storedCostCategory(undefined)).toBe('other');
+ });
+
+ it('COST-CATEGORY-005: the hint an assistant reads names every key', () => {
+ for (const key of ['accommodation', 'food', 'transport', 'flights', 'other'])
+ expect(COST_CATEGORY_HINT).toContain(key);
+ });
});