From 5faa8d7e0ed477a1b6c6a466c432fedfcb307101 Mon Sep 17 00:00:00 2001 From: zulfikarrosadi Date: Thu, 21 Nov 2024 15:37:58 +0700 Subject: [PATCH] fix(test): update types so test can run --- src/product/repository.ts | 2 +- src/product/schema.ts | 3 ++- src/product/service.test.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/product/repository.ts b/src/product/repository.ts index c650dc8..52a3e6c 100644 --- a/src/product/repository.ts +++ b/src/product/repository.ts @@ -131,7 +131,7 @@ class ProductRepository { return products } - async deleteProductById(id: number) { + async deleteProductById(id: bigint) { try { await this.prisma.products.delete({ where: { diff --git a/src/product/schema.ts b/src/product/schema.ts index e6fd0ac..6a5189c 100644 --- a/src/product/schema.ts +++ b/src/product/schema.ts @@ -37,6 +37,7 @@ export type UpdateProductDataService = { new: string[] } } -export type FlattenUpdateProduct = Omit & { +export type FlattenUpdateProduct = Omit & { images: string[] + price: number } diff --git a/src/product/service.test.ts b/src/product/service.test.ts index 03ef5e6..856cf65 100644 --- a/src/product/service.test.ts +++ b/src/product/service.test.ts @@ -41,6 +41,7 @@ describe('product service', () => { createProduct: jest.fn(), getProductById: jest.fn(), getProducts: jest.fn(), + deleteProductById: jest.fn(), } as unknown as jest.Mocked productService = new ProductService(productRepo, logger)