diff --git a/tests/unit/scaler.test.ts b/tests/unit/scaler.test.ts index 472ac31..7aca3b5 100644 --- a/tests/unit/scaler.test.ts +++ b/tests/unit/scaler.test.ts @@ -41,4 +41,15 @@ describe('scaleIngredients', () => { const scaled = scaleIngredients([mk(100, 'g', 'Butter')], 1 / 3); 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); + }); });