Skip to content
Snippets Groups Projects
Commit 066f2b88 authored by henrikburmann's avatar henrikburmann
Browse files

Axious test..

parent 20984a7c
No related branches found
No related tags found
1 merge request!154Rent testing
......@@ -2,13 +2,23 @@ import { mount } from "@vue/test-utils";
import NewRent from "@/components/RentingComponents/NewRent.vue";
import axios from "axios";
jest.mock("@/utils/token-utils", () => {
// jest.mock("@/utils/token-utils", () => {
// return {
// tokenHeader: () => {
// return {};
// },
// parseCurrentUser: () => {
// return { accountId: 1 };
// },
// };
// });
jest.mock("@/utils/apiutil", () => {
return {
tokenHeader: () => {
return {};
},
parseCurrentUser: () => {
return { accountId: 1 };
postNewRent: () => {
return new Promise((resolve) => {
resolve([]);
});
},
};
});
......@@ -45,13 +55,12 @@ describe("Confirm and send a rent request", () => {
});
it("Check that clicking rent opens confirmbox",async () => {
wrapper.find("#confirmButton").trigger("click");
const button = wrapper.find("#confirmButton");
axios.post.mockResolvedValueOnce();
button.trigger("click");
// await wrapper.vm.$nextTick();
await axios.put.mockResolvedValueOnce(props.newRentBox);
await wrapper.vm.$nextTick();
// expect(wrapper.find("notification-modal").exists()).toBeTruthy();
expect(axios.post).toHaveBeenCalledTimes(1);
......
......@@ -34,8 +34,7 @@ describe("UserItems component", () => {
it("Check headline", () => {
expect(wrapper.find("#headline").text()).toMatch("Mine gjenstander");
});
// it("Check title", () => {
// expect(wrapper.findAll(".ItemCardPage")[0].exists()).toBeTruthy();
// })
});
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