From 6917d944fe36addc79d4123aa792fe2c29746522 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Mon, 1 Dec 2025 22:00:27 +1000 Subject: [PATCH] Fix type issues in tests --- src/components/__tests__/AddProductDialog.test.tsx | 2 +- src/components/__tests__/ProductRow.errors.test.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/__tests__/AddProductDialog.test.tsx b/src/components/__tests__/AddProductDialog.test.tsx index d10ed3a..51040a7 100644 --- a/src/components/__tests__/AddProductDialog.test.tsx +++ b/src/components/__tests__/AddProductDialog.test.tsx @@ -57,7 +57,7 @@ describe('AddProductDialog', () => { }); it('applies initialBarcode and triggers lookup', async () => { - fetchProductSpy.mockResolvedValue({ name: 'From OFF' }); + fetchProductSpy.mockResolvedValue({ name: 'From OFF', source: 'openfoodfacts' }); render( ({ @@ -18,20 +19,23 @@ const categoriesById = new Map([ ['cat-2', 'Drinks'], ]); -const baseProduct = { +const baseProduct: Product = { id: 'p1', name: 'Product One', category: 'cat-1', unit_type: 'unit', bulk_name: 'carton', + barcode: undefined, archived: false, created_at: 0, updated_at: 0, }; describe('ProductRow error handling', () => { - let onSave: ReturnType; - let onDelete: ReturnType; + let onSave: ReturnType< + typeof vi.fn<(productId: string, updates: { name: string; category: string; barcode?: string }) => void> + >; + let onDelete: ReturnType void>>; beforeEach(() => { onSave = vi.fn();