Add auto-add option for pick lists and sync new products

This commit is contained in:
beatz174-bit
2025-11-23 16:01:10 +10:00
parent c29c779fd8
commit 3fa9e6df5f
8 changed files with 189 additions and 13 deletions
+6
View File
@@ -100,6 +100,8 @@ describe('StartPickListScreen', () => {
categoriesMock.forEach((category) => {
expect(screen.getByRole('checkbox', { name: category.name })).toBeInTheDocument();
});
expect(screen.getByRole('checkbox', { name: /add new products/i })).toBeChecked();
});
it('prefills a new pick list with products from selected categories', async () => {
@@ -132,6 +134,10 @@ describe('StartPickListScreen', () => {
expect(item.quantity).toBe(1);
expect(item.status).toBe('pending');
});
const pickListRecord = pickListAddMock.mock.calls[0][0];
expect(pickListRecord.categories).toEqual(['Drinks', 'Snacks']);
expect(pickListRecord.auto_add_new_products).toBe(true);
});
it('deduplicates products when selected categories include overlaps', async () => {