From 73dcc3f4ed765d4a0947e0dcbbcfbaabab91e65f Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 24 Oct 2024 11:06:05 +0800 Subject: [PATCH] Fix test for deleteUser --- Server/tests/controllers/authController.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/tests/controllers/authController.test.js b/Server/tests/controllers/authController.test.js index d9329e54e..9b9c64cd5 100644 --- a/Server/tests/controllers/authController.test.js +++ b/Server/tests/controllers/authController.test.js @@ -812,9 +812,9 @@ describe("Auth Controller - deleteUser", () => { afterEach(() => { sinon.restore(); }); - it("should return 404 if user is not found", async () => { + it("should throw an error if user is not found", async () => { jwt.decode.returns({ email: "test@example.com" }); - req.db.getUserByEmail.resolves(null); + req.db.getUserByEmail.throws(new Error(errorMessages.DB_USER_NOT_FOUND)); await deleteUser(req, res, next);