Skip to content

Commit

Permalink
unit test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
marqueone-ps committed Oct 17, 2023
1 parent 93262b1 commit 3dc5f0f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions backend/src/v1/hwcr_complaint/hwcr_complaint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,5 @@ export class HwcrComplaintService {
const [data, totalCount] = await queryBuilder.getManyAndCount();
return { complaints: data, totalCount };
}

return Promise.resolve({ complaints: [], totalCount: 0 });
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)

});
});

Original file line number Diff line number Diff line change
Expand Up @@ -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])

})),
});

0 comments on commit 3dc5f0f

Please sign in to comment.