Skip to content
Snippets Groups Projects
Commit a676ca5f authored by Øivind Haugerøy Larsson's avatar Øivind Haugerøy Larsson
Browse files

updateTest

parent a4e1b899
No related branches found
No related tags found
No related merge requests found
Pipeline #22822 failed with stages
in 58 seconds
......@@ -23,12 +23,9 @@ module.exports = class PersonDao extends Dao {
}
updateOne(id, json, callback) {
var val = [json.navn, json.adresse, json.alder, id];
super.query(
"update person set navn=?, adresse=?, alder=? where id=?",
[json.navn],
[json.adresse],
[json.alder],
[id],
callback
)
}
......
......@@ -75,5 +75,24 @@ test("get all persons from db", done => {
done();
}
test("update person from db", done => {
function callback(status, data) {
personDao.getOne(2, getCallback);
}
function getCallback(status, data) {
console.log(
"Test callback: status= " + status + ", data=" +JSON.stringify(data)
);
expect(data.length).toBe(1);
expect(data[0].alder).toBe(23);
done();
}
personDao.updateOne(
2,
{navn: "Hei Heisen", adresse: "Gata 2", alder: "23"},
callback
);
})
personDao.getAll(callback);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment