From 10d2d53ecfb1066933666bd521e780d3342d5b30 Mon Sep 17 00:00:00 2001 From: rohitcpp Date: Mon, 16 Mar 2026 00:36:34 +0530 Subject: [PATCH 1/2] fix: test files --- tests/billing.test.js | 3 ++- tests/billing_flow.test.js | 1 + tests/patient.test.js | 2 +- tests/patient_flow.test.js | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/billing.test.js b/tests/billing.test.js index c1aa665..7e51ee7 100644 --- a/tests/billing.test.js +++ b/tests/billing.test.js @@ -59,7 +59,8 @@ describe('Billing Integration Tests', () => { .set('Authorization', `Bearer ${adminToken}`) .send({ patient: 'patId', - amount: 1500 + amount: 1500, + paymentMode: 'cash', // appointment is optional per controller }); diff --git a/tests/billing_flow.test.js b/tests/billing_flow.test.js index bb31f6f..2bd94ca 100644 --- a/tests/billing_flow.test.js +++ b/tests/billing_flow.test.js @@ -63,6 +63,7 @@ describe('HMS Billing Flow Integration', () => { patient: patientId, amount: 500, status: 'pending', + paymentMode: 'cash', items: [{ desc: 'Consultation', price: 500 }] }); diff --git a/tests/patient.test.js b/tests/patient.test.js index d6ea684..a76e31e 100644 --- a/tests/patient.test.js +++ b/tests/patient.test.js @@ -60,7 +60,7 @@ describe('Patient Integration Tests', () => { }); expect(res.statusCode).toBe(201); - expect(res.body._id).toBeDefined(); + expect(res.body.data._id).toBeDefined(); }); it('should fail if missing required patient details', async () => { diff --git a/tests/patient_flow.test.js b/tests/patient_flow.test.js index 1c37b6d..0b49da4 100644 --- a/tests/patient_flow.test.js +++ b/tests/patient_flow.test.js @@ -55,7 +55,7 @@ describe('HMS Patient Flow Integration', () => { expect(res.statusCode).toBe(201); expect(res.body._id).toBeDefined(); - patientId = res.body._id; + patientId = res.body.data._id; }); it('2. Should fetch patient by ID (Verifying the 404 fix)', async () => { From 08b680cb292d6411536207939e4bcad374644a79 Mon Sep 17 00:00:00 2001 From: rohitcpp Date: Mon, 16 Mar 2026 00:43:46 +0530 Subject: [PATCH 2/2] fix: test data payload --- tests/billing_flow.test.js | 4 ++-- tests/patient.test.js | 2 +- tests/patient_flow.test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/billing_flow.test.js b/tests/billing_flow.test.js index 2bd94ca..3c83496 100644 --- a/tests/billing_flow.test.js +++ b/tests/billing_flow.test.js @@ -68,7 +68,7 @@ describe('HMS Billing Flow Integration', () => { }); expect([200, 201]).toContain(res.statusCode); - billId = res.body.data?._id || res.body._id; + billId = res.body._id; expect(billId).toBeDefined(); }); @@ -91,7 +91,7 @@ describe('HMS Billing Flow Integration', () => { }); expect(res.statusCode).toBe(200); - const updatedBill = res.body.data || res.body; + const updatedBill = res.body; expect(updatedBill.status).toBe('paid'); }); }); diff --git a/tests/patient.test.js b/tests/patient.test.js index a76e31e..d6ea684 100644 --- a/tests/patient.test.js +++ b/tests/patient.test.js @@ -60,7 +60,7 @@ describe('Patient Integration Tests', () => { }); expect(res.statusCode).toBe(201); - expect(res.body.data._id).toBeDefined(); + expect(res.body._id).toBeDefined(); }); it('should fail if missing required patient details', async () => { diff --git a/tests/patient_flow.test.js b/tests/patient_flow.test.js index 0b49da4..1c37b6d 100644 --- a/tests/patient_flow.test.js +++ b/tests/patient_flow.test.js @@ -55,7 +55,7 @@ describe('HMS Patient Flow Integration', () => { expect(res.statusCode).toBe(201); expect(res.body._id).toBeDefined(); - patientId = res.body.data._id; + patientId = res.body._id; }); it('2. Should fetch patient by ID (Verifying the 404 fix)', async () => {