Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing console logs from backend #45

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions server/controllers/medicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ exports.getListOfMedications = function(req, res) {
const userID = req.body.userID;

if (userID == null) {
console.log(userID);
res.status(400).json({
success: false
});
} else {
db.getMedications(userID, function(err, rows) {
if (err) {
console.log(err);
res.status(400).json({
success: false
});
Expand Down Expand Up @@ -226,9 +224,7 @@ exports.getMedicationHistory = function(req, res) {
success: false
});
} else {
console.log(rows);
res.status(200).send(rows);

}
});
}
Expand Down
2 changes: 0 additions & 2 deletions server/controllers/prescriptionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ exports.repeatedMedication = function(req, res) {

exports.localPharmacy = function(req, res) {
const userID = req.body.userID
console.log("PHARMACY USERID: " + userID)
if (userID == null) {
res.status(400).json({
success: false
});
} else {
console.log("PREPARING QUERY")
db.getLocalPharmacy(userID, function(err, rows) {
if (err) {
res.status(400).json({
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/taskController.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports.insertAnswer = function(req, res) {
res.status(400).json({
success: false
});
} if (answer == null) {
} else if (answer == null) {
res.status(400).json({
success: false
});
Expand Down
102 changes: 0 additions & 102 deletions server/test/appointmentControllerTest.js

This file was deleted.

60 changes: 47 additions & 13 deletions server/test/integration/appointmentControllerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,101 @@ let chai = require('chai');
let should = chai.should();
var assert = chai.assert;

describe('Patient Appointment View', function() {
describe('Patient Appointment View', function () {
var app;
beforeEach(function() {
beforeEach(function () {
app = require('../../index');
});
afterEach(function() {
afterEach(function () {
app.close();
});
it('Returns status code 200 with no user ID passed', function(done) {
it('Returns status code 200 with no user ID passed', function (done) {
request(app)
.post('/appointment/getAllAppointmentsByUserID')
.expect(200, done);
});
it('Returns status code 200 with valid data using user ID 1', function(done) {
it('Returns status code 200 with valid data using user ID 1', function (done) {
request(app)
.post('/appointment/getAllAppointmentsByUserID')
.send('userID=1')
.expect(200, done);
});
it('Returns status code 200 with valid data using user ID 3', function(done) {
it('Returns status code 200 with valid data using user ID 3', function (done) {
request(app)
.post('/appointment/getAllAppointmentsByUserID')
.send('userID=3')
.expect(200, done);
});
it('Returns status code 404 with invalid route', function(done) {
it('Returns status code 404 with invalid route', function (done) {
request(app)
.post('/appointment/getAllAppointmentsByUserI')
.send('userID=1')
.expect(404, done);
});
});

describe('Patient Portal Appointment Modal', function() {
describe('Patient Portal Appointment Modal', function () {
var app;
beforeEach(function() {
beforeEach(function () {
app = require('../../index');
});
afterEach(function() {
afterEach(function () {
app.close();
});
it('restablish connection return status code 200 with no appointmentID', function(done) {
it('restablish connection return status code 200 with no appointmentID', function (done) {
request(app)
.post('/appointment/getAppointmentFurtherInfo')
.send('appointmentID')
.expect(200, done);
});

it('returns status code 200 with valid query data', function(done) {
it('returns status code 200 with valid query data', function (done) {
request(app)
.post('/appointment/getAppointmentFurtherInfo')
.send('appointmentID=1')
.expect(200, done);
});

it('returns status code 404 with page not found', function(done) {
it('returns status code 404 with page not found', function (done) {
request(app)
.post('/appointment/getAppointmentFurtherWroungRoute')
.send('appointmentID=1')
.expect(404, done);
});

});

describe('Patient Portal Previous Appointments', function () {
var app;
beforeEach(function () {
app = require('../../index');
});
afterEach(function () {
app.close();
});
it('Returns status code 200 with no user ID passed', function (done) {
request(app)
.post('/appointment/previous')
.expect(200, done);
});
it('Returns status code 200 with valid data using user ID 1', function (done) {
request(app)
.post('/appointment/previous')
.send('userID=1')
.expect(200, done);
});
it('Returns status code 200 with valid data using user ID 3', function (done) {
request(app)
.post('/appointment/previous')
.send('userID=3')
.expect(200, done);
});
it('Returns status code 404 with invalid route', function (done) {
request(app)
.post('/appointment/previousUser1')
.send('userID=1')
.expect(404, done);
});
});

describe('Patient Portal Appointment Query Modal', function() {
Expand Down