Skip to content
Snippets Groups Projects
Commit 004557b4 authored by Fredrik Monsen's avatar Fredrik Monsen
Browse files

Added test-methods

parent c08e4416
Branches
No related tags found
No related merge requests found
Pipeline #22578 failed
......@@ -73,3 +73,23 @@ test("get all persons from db", done => {
personDao.getAll(callback);
});
test("delete person from db", done => {
function callback(status, data) {
console.log("Test callback: status=" + status + ", data=" + JSON.stringify(data));
expect(data.length).toBe(2);
done();
}
personDao.deleteOne( {id: 1}, callback );
});
test("update one person from db", done => {
function callback(status, data) {
console.log(
"Test callback: status=" + status + ", data=" + JSON.stringify(data)
);
expect(data.affectedRows).toBe(1);
done();
}
personDao.updateOne({adresse: "Prinsens gate"}, callback);
});
......@@ -49,4 +49,12 @@ app.post("/person", (req, res) => {
});
});
app.post("/person", (req, res) => {
console.log("/person: Fikk POST request fra klienten");
personDao.deleteOne(req.body, (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