Skip to content
Snippets Groups Projects

sonar coverage

2 files
+ 55
3
Compare changes
  • Side-by-side
  • Inline

Files

@@ -43,7 +43,7 @@ describe('DoctorController', () => {
it('should create a doctor and return success with doctorId', async () => {
const createDoctorDto: CreateDoctorDto = {
doctorName: 'Dr. Test',
doctorQualificationId: 'qual-uuid-xyz',
doctorQualificationId: 'c6f3dc4a-7e2f-4f9b-a77b-bbccffe42388',
doctorSpecialityId: 'spec-uuid-abc',
emailId: 'dr.test@example.com',
contactNo: '1234567890', doctorRegNo: 'REG12345',
@@ -63,7 +63,7 @@ describe('DoctorController', () => {
it('should return error response if service throws an error', async () => {
const createDoctorDto: CreateDoctorDto = {
doctorName: 'Dr. Error',
doctorQualificationId: 'qual-uuid-err-xyz',
doctorQualificationId: 'c6f3dc4a-7e2f-4f9b-a77b-bbccffe42388',
doctorSpecialityId: 'spec-uuid-err-abc',
emailId: 'dr.error@example.com',
contactNo: '0987654321', doctorRegNo: 'REG67890',
@@ -148,7 +148,8 @@ describe('updateDoctors', () => {
doctorQualificationId: '58c1b3f1-0007-4444-aaaa-000000000007',
contactNo: '7208806389',
hprCode: 'HPR-111', emailId: 'prathviraj@abc.com',
panNo: 'SLEUS7686D', address: 'Mumbai',
panNo: 'SLEUS7686D',
address: 'Mumbai',
stateId: 'f77da58f-422f-4b26-b6ab-ab02fe9cd00d',
cityId: 'e9af1491-7b1e-4010-9542-af36700d5f89',
pincode: '2c1fe645-989c-4705-91ef-36f3c78c0d08',
@@ -166,3 +167,27 @@ describe('updateDoctors', () => {
expect(result).toEqual(response);
});
});
describe('CreateDoctorDto validation', () => {
it('should validate doctorQualificationId as a UUID', async () => {
const { validate } = await import('class-validator');
const dto = new CreateDoctorDto();
dto.doctorQualificationId = 'c6f3dc4a-7e2f-4f9b-a77b-bbccffe42388';
// Add required fields to pass validation
dto.doctorName = 'Dr. Valid';
dto.doctorSpecialityId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
dto.emailId = 'dr.valid@example.com';
dto.contactNo = '1234567890';
dto.doctorRegNo = 'REG12345';
dto.hprCode = 'HPR123';
dto.panNo = 'ABCDE1234F';
dto.address = '123 Test St';
dto.pincodeId = 'b1c2d3e4-f5a6-7890-bcde-fa1234567890';
dto.latitude = 12.345678;
dto.longitude = 78.901234;
dto.created_by = '6f6b90a9-331e-4874-a374-ebf65a1bce2a';
dto.updated_by = '6f6b90a9-331e-4874-a374-ebf65a1bce2a';
const errors = await validate(dto);
expect(errors.length).toBe(0);
});
});
Loading