From 6bb2458e3397e5d90ea49ea4c081df300240f5e6 Mon Sep 17 00:00:00 2001
From: Titus Kristiansen <titusk@stud.ntnu.no>
Date: Mon, 25 Apr 2022 14:42:34 +0200
Subject: [PATCH] Updated mock test

---
 tests/unit/apiutil-login-mock.spec.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/unit/apiutil-login-mock.spec.js b/tests/unit/apiutil-login-mock.spec.js
index 5b6a07b..cbb649c 100644
--- a/tests/unit/apiutil-login-mock.spec.js
+++ b/tests/unit/apiutil-login-mock.spec.js
@@ -7,8 +7,9 @@ describe("testing mocking of apiutil.js", () => {
   it("check that login fails with wrong credentials - against mock", async () => {
     // mock api response on POST call (once)
     const expectedLoginResponse = "Login failed" ;
+
     axios.post.mockImplementation(() =>
-      Promise.resolve(expectedLoginResponse)
+      Promise.resolve({data: "Login failed"})
     );
 
     // do the call
@@ -29,7 +30,7 @@ describe("testing mocking of apiutil.js", () => {
         "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
     };
     const expectedLoginResponse = "Login failed";
-    axios.post.mockImplementation(() => Promise.resolve(apiResponse ));
+    axios.post.mockImplementation(() => Promise.resolve({data: apiResponse}));
 
     // do the call
     const loginRequest = {
-- 
GitLab