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

This commit is contained in:
Maurice
2026-11-04 15:29:29 +01:00
parent 67ca58f2a5
commit 9f5d01ee09
+16 -2
View File
@@ -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);
});
});