Skip to content
Snippets Groups Projects
Commit ebabd76b authored by Mahmoud Ibrahim Mohammad's avatar Mahmoud Ibrahim Mohammad
Browse files

Testing update and delete person

parent c73de812
No related branches found
No related tags found
No related merge requests found
Pipeline #49656 failed
......@@ -37,4 +37,9 @@ module.exports = class PersonDao extends Dao {
callback
);
}
countAll(callback){
super.query(
"SELECT COUNT(*) FROM person;",[],callback
)
}
};
......@@ -83,7 +83,7 @@ test("oppdater person to db", done => {
console.log(
"Test callback: status=" + status + ", data=" + JSON.stringify(data)
);
expect(data.affectedRows).toBeGreaterThanOrEqual(1);
expect(data.affectedRows).toBe(1);
done();
}
......@@ -92,11 +92,11 @@ test("oppdater person to db", done => {
});
test("slett person to db", done => {
function callback(status, data) {
function callback(status) {
console.log(
"Test callback: status=" + status + ", data=" + JSON.stringify(data)
);
expect(data.affectedRows).toBeGreaterThanOrEqual(1);
expect(personDao.countAll((status, data))).toEqual(1);
done();
}
......
......@@ -57,4 +57,12 @@ app.delete("/person/:personId", (req, res) => {
});
});
app.get("/person", (req, res) => {
console.log("/person: fikk request fra klient");
personDao.countAll((status, data) => {
res.status(status);
res.json(data);
});
});
var server = app.listen(8080);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment