From 8eef831794fecf011a45e5fba5f01c6e45291f4f Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 24 Oct 2024 12:00:25 +0800 Subject: [PATCH] update tests --- .../tests/controllers/monitorController.test.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Server/tests/controllers/monitorController.test.js b/Server/tests/controllers/monitorController.test.js index 8411b4bda..01ed666e7 100644 --- a/Server/tests/controllers/monitorController.test.js +++ b/Server/tests/controllers/monitorController.test.js @@ -821,20 +821,11 @@ describe("Monitor Controller - editMonitor", () => { expect(next.firstCall.args[0]).to.be.an("error"); expect(next.firstCall.args[0].message).to.equal("Add Job error"); }); - it("should return success message with data if all operations succeed and empty notifications", async () => { + it("should fail validation with empty notifications", async () => { req.body.notifications = []; - const monitor = { _id: "123" }; - req.db.getMonitorById.returns({ teamId: "123" }); - req.db.editMonitor.returns(monitor); await editMonitor(req, res, next); - expect(res.status.firstCall.args[0]).to.equal(200); - expect( - res.json.calledOnceWith({ - success: true, - msg: successMessages.MONITOR_EDIT, - data: monitor, - }) - ).to.be.true; + expect(next.firstCall.args[0]).to.be.an("error"); + expect(next.firstCall.args[0].status).to.equal(422); }); it("should return success message with data if all operations succeed", async () => { const monitor = { _id: "123" };