Skip to content
Snippets Groups Projects
Commit 6bb2458e authored by Titus Netland's avatar Titus Netland
Browse files

Updated mock test

parent f989e76d
No related branches found
No related tags found
1 merge request!12API login mock tests
Pipeline #175608 failed
...@@ -7,8 +7,9 @@ describe("testing mocking of apiutil.js", () => { ...@@ -7,8 +7,9 @@ describe("testing mocking of apiutil.js", () => {
it("check that login fails with wrong credentials - against mock", async () => { it("check that login fails with wrong credentials - against mock", async () => {
// mock api response on POST call (once) // mock api response on POST call (once)
const expectedLoginResponse = "Login failed" ; const expectedLoginResponse = "Login failed" ;
axios.post.mockImplementation(() => axios.post.mockImplementation(() =>
Promise.resolve(expectedLoginResponse) Promise.resolve({data: "Login failed"})
); );
// do the call // do the call
...@@ -29,7 +30,7 @@ describe("testing mocking of apiutil.js", () => { ...@@ -29,7 +30,7 @@ describe("testing mocking of apiutil.js", () => {
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
}; };
const expectedLoginResponse = "Login failed"; const expectedLoginResponse = "Login failed";
axios.post.mockImplementation(() => Promise.resolve(apiResponse )); axios.post.mockImplementation(() => Promise.resolve({data: apiResponse}));
// do the call // do the call
const loginRequest = { const loginRequest = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment