From fac8f1674bc2061e7cab67624caeafa2fdff755e Mon Sep 17 00:00:00 2001 From: hermanrm <hermanrm@stud.ntnu.no> Date: Tue, 25 Sep 2018 10:59:26 +0200 Subject: [PATCH] La til tester for update og delete --- dao/persondao.test.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dao/persondao.test.js b/dao/persondao.test.js index 79f786b..532afb7 100644 --- a/dao/persondao.test.js +++ b/dao/persondao.test.js @@ -77,3 +77,31 @@ test("get all persons from db", done => { personDao.getAll(callback); }); + +test("update a person in the db", done => { + function callback(status, data) { + console.log( + "Test callback: status=" + status + ", data=" + JSON.stringify(data) + ); + expect(data[0].navn).toBe("Test"); + done(); + } + + personDao.updateOne(1, + {navn:"Test",adresse:"Gata 5",alder:45}, + callback); +}); + +test("remove a person from db", done => { + function callback(status, data) { + console.log( + "Test callback: status=" + status + ", data=" + JSON.stringify(data) + ); + expect(data.length).toBe(1); + done(); + } + + personDao.deleteOne(1, callback); +}); + + -- GitLab