From 9f5d01ee099d6e8e6cce1d3c9602b2607335f148 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 4 Nov 2026 15:29:29 +0100 Subject: [PATCH] test(shared): cover the stored Costs category and the hint the MCP reads --- shared/src/budget/cost-category.spec.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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); + }); });