test(scaler): section_heading ueberlebt Skalierung

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-19 15:00:21 +02:00
parent a1baf7f30a
commit 96cb55495e

View File

@@ -41,4 +41,15 @@ describe('scaleIngredients', () => {
const scaled = scaleIngredients([mk(100, 'g', 'Butter')], 1 / 3); const scaled = scaleIngredients([mk(100, 'g', 'Butter')], 1 / 3);
expect(scaled[0].quantity).toBe(33); expect(scaled[0].quantity).toBe(33);
}); });
it('preserves section_heading through scaling', () => {
const input: Ingredient[] = [
{ position: 1, quantity: 200, unit: 'g', name: 'Mehl', note: null, raw_text: '200 g Mehl', section_heading: 'Teig' },
{ position: 2, quantity: null, unit: null, name: 'Ei', note: null, raw_text: 'Ei', section_heading: null }
];
const scaled = scaleIngredients(input, 2);
expect(scaled[0].section_heading).toBe('Teig');
expect(scaled[1].section_heading).toBeNull();
expect(scaled[0].quantity).toBe(400);
});
}); });