Skip to content

Commit

Permalink
hot fix: remove error test from patient
Browse files Browse the repository at this point in the history
  • Loading branch information
YehiaFarghaly committed Jan 12, 2024
1 parent fb1e339 commit d8e2114
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
7 changes: 1 addition & 6 deletions clinic/src/utils/TestingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions patient/src/tests/api-tests/OrderAPI.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
8 changes: 1 addition & 7 deletions patient/src/utils/TestingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d8e2114

Please sign in to comment.