fix(shopping): NULLIF-Guard gegen servings_default=0 in Aggregation
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build & Publish Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -172,4 +172,16 @@ describe('listShoppingList aggregation', () => {
|
||||
addRecipeToCart(db, id, null);
|
||||
expect(listShoppingList(db).uncheckedCount).toBe(2);
|
||||
});
|
||||
|
||||
it('does not blow up when servings_default is zero (silent NULL total_quantity)', () => {
|
||||
const db = openInMemoryForTest();
|
||||
const id = insertRecipe(db, recipe({
|
||||
servings_default: 0,
|
||||
ingredients: [{ position: 1, quantity: 100, unit: 'g', name: 'Mehl', note: null, raw_text: '', section_heading: null }]
|
||||
}));
|
||||
addRecipeToCart(db, id, null, 4);
|
||||
const rows = listShoppingList(db).rows;
|
||||
expect(rows).toHaveLength(1);
|
||||
expect(rows[0].total_quantity).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user