From 8a99f935e13c981f319c957e51726e1ea4e828c9 Mon Sep 17 00:00:00 2001 From: Jorgen <Jorgen@LAPTOP-CK3892L1> Date: Tue, 25 Sep 2018 10:10:28 +0200 Subject: [PATCH] la til feil i deletetest --- dao/persondao.test.js | 3 +-- package-lock.json | 28 +++++++++++++++++++++------- server.js | 8 ++++---- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/dao/persondao.test.js b/dao/persondao.test.js index ca67b46..3d478a6 100644 --- a/dao/persondao.test.js +++ b/dao/persondao.test.js @@ -93,11 +93,10 @@ test("update person in db", done => { ); }); - test("delete person in db", done => { function callback(status, data) { console.log("Test callback: status=" + status + ", data" + JSON.stringify(data)); - expect(data.affectedRows).toBeGreaterThanOrEqual(1); + expect(data.affectedRows).toBeGreaterThanOrEqual(0); done(); } personDao.deleteOne({id: 2}, callback); diff --git a/package-lock.json b/package-lock.json index aa95630..4696110 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1682,11 +1682,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1699,15 +1701,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -1810,7 +1815,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -1820,6 +1826,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1832,17 +1839,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1859,6 +1869,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -1931,7 +1942,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -1941,6 +1953,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -2046,6 +2059,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/server.js b/server.js index d940352..370078c 100644 --- a/server.js +++ b/server.js @@ -9,9 +9,9 @@ const PersonDao = require("./dao/persondao.js"); var pool = mysql.createPool({ connectionLimit: 2, host: "mysql.stud.iie.ntnu.no", - user: "nilstesd", - password: "lqqWcMzq", - database: "nilstesd", + user: "jorgaas", + password: "sPrzGgz9", + database: "jorgaas", debug: false }); @@ -43,7 +43,7 @@ app.post("/person", (req, res) => { app.delete("/person/:personId",(req,res)=> { console.log("Fikk DELETE-request fra klienten"); - personDao.deleteOne(req.params.personID, (status,data) =>{ + personDao.deleteOne(req.params.personId, (status,data) =>{ res.status(status); res.json(data); }); -- GitLab