From d8e211404190c06d11938cfa1717aefe5f8c648b Mon Sep 17 00:00:00 2001 From: Yehia Mohamed <102627389+YehiaFarghaly@users.noreply.github.com> Date: Sat, 13 Jan 2024 01:37:20 +0200 Subject: [PATCH] hot fix: remove error test from patient --- clinic/src/utils/TestingUtils.js | 7 +------ patient/src/tests/api-tests/OrderAPI.test.js | 6 ------ patient/src/utils/TestingUtils.js | 8 +------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/clinic/src/utils/TestingUtils.js b/clinic/src/utils/TestingUtils.js index 38794352..509eff6a 100644 --- a/clinic/src/utils/TestingUtils.js +++ b/clinic/src/utils/TestingUtils.js @@ -14,12 +14,7 @@ const connectDBTest = async () => { const disconnectDBTest = async () => { try { - const collections = mongoose.connection.collections; - - for (const key in collections) { - const collection = collections[key]; - await collection.deleteMany({}); - } + await mongoose.connection.db.dropDatabase(); await mongoose.disconnect(); } catch (err) { console.error('Error connecting to the database:', err.message); diff --git a/patient/src/tests/api-tests/OrderAPI.test.js b/patient/src/tests/api-tests/OrderAPI.test.js index ff9fd14d..489531d4 100644 --- a/patient/src/tests/api-tests/OrderAPI.test.js +++ b/patient/src/tests/api-tests/OrderAPI.test.js @@ -38,12 +38,6 @@ describe('GET /order/:patientId', () => { expect(res._body.length).toBe(len); }); - it('should return 500 ERROR when the id is invalid', async () => { - const id = faker.lorem.word(); - const res = await request(app).get(`/order/${id}`); - expect(res.status).toBe(ERROR_STATUS_CODE); - }); - afterEach(async () => { await disconnectDBTest(); }); diff --git a/patient/src/utils/TestingUtils.js b/patient/src/utils/TestingUtils.js index e0536a49..509eff6a 100644 --- a/patient/src/utils/TestingUtils.js +++ b/patient/src/utils/TestingUtils.js @@ -14,13 +14,7 @@ const connectDBTest = async () => { const disconnectDBTest = async () => { try { - const collections = mongoose.connection.collections; - - for (const key in collections) { - const collection = collections[key]; - await collection.deleteMany({}); - } - + await mongoose.connection.db.dropDatabase(); await mongoose.disconnect(); } catch (err) { console.error('Error connecting to the database:', err.message);