diff --git a/backend/src/v1/hwcr_complaint/hwcr_complaint.service.ts b/backend/src/v1/hwcr_complaint/hwcr_complaint.service.ts index dcfbf9a8f..b9eabdd8f 100644 --- a/backend/src/v1/hwcr_complaint/hwcr_complaint.service.ts +++ b/backend/src/v1/hwcr_complaint/hwcr_complaint.service.ts @@ -989,7 +989,5 @@ export class HwcrComplaintService { const [data, totalCount] = await queryBuilder.getManyAndCount(); return { complaints: data, totalCount }; } - - return Promise.resolve({ complaints: [], totalCount: 0 }); }; } diff --git a/backend/src/v1/hwcr_complaint/hwcr_complaint.service.v2.spec.ts b/backend/src/v1/hwcr_complaint/hwcr_complaint.service.v2.spec.ts index 40e45f425..e354d6ce9 100644 --- a/backend/src/v1/hwcr_complaint/hwcr_complaint.service.v2.spec.ts +++ b/backend/src/v1/hwcr_complaint/hwcr_complaint.service.v2.spec.ts @@ -115,11 +115,11 @@ describe("Testing: HwcrComplaintService", () => { const result = await service.complaintSearch(payload); expect(result).not.toBe(null); - console.log("result: ", result) + const { complaints, totalCount} = result; expect(complaints.length).toBeGreaterThanOrEqual(1) expect(totalCount).toBeGreaterThan(0) - + }); }); diff --git a/backend/test/mocks/mock-wildlife-conflict-complaint-repository.ts b/backend/test/mocks/mock-wildlife-conflict-complaint-repository.ts index 0e72364e5..cdbee03a2 100644 --- a/backend/test/mocks/mock-wildlife-conflict-complaint-repository.ts +++ b/backend/test/mocks/mock-wildlife-conflict-complaint-repository.ts @@ -46,9 +46,9 @@ const createQueryBuilder: any = { select: jest.fn().mockReturnThis(), addSelect: jest.fn().mockReturnThis(), from: jest.fn().mockReturnThis(), - skip: jest.fn().mockResolvedValue(5), + skip: jest.fn().mockReturnThis(), take: jest.fn().mockReturnThis(), - getManyAndCount: jest.fn().mockResolvedValue({ data: [...manyItems], totalCount: 35}) + getManyAndCount: jest.fn().mockResolvedValue([manyItems, 35]) })), }); \ No newline at end of file