From 4e328f7641f2f2c4c5e99d1e696e810e21468a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20R=C3=B8skaft?= <haakoero@stud.ntnu.no> Date: Fri, 6 May 2022 15:16:52 +0200 Subject: [PATCH] Linted and removed unnessesary console logs --- src/components/BaseComponents/RatingModal.vue | 2 ++ src/components/ItemComponents/NewItemForm.vue | 2 -- src/components/RentingComponents/ItemInfo.vue | 3 +-- src/views/ItemViews/EditItemView.vue | 2 +- .../renting-compnents-tests/new-rent.spec.js | 18 +++++++++--------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/BaseComponents/RatingModal.vue b/src/components/BaseComponents/RatingModal.vue index e65e9a4..1b09b8f 100644 --- a/src/components/BaseComponents/RatingModal.vue +++ b/src/components/BaseComponents/RatingModal.vue @@ -189,6 +189,8 @@ export default { const postResponse = await postNewRating(ratingInfo); + console.log("posted: " + postResponse); + this.$router.push("/"); }, }, diff --git a/src/components/ItemComponents/NewItemForm.vue b/src/components/ItemComponents/NewItemForm.vue index c465454..3ef622f 100644 --- a/src/components/ItemComponents/NewItemForm.vue +++ b/src/components/ItemComponents/NewItemForm.vue @@ -328,7 +328,6 @@ export default { }; }, methods: { - /** * Checks validation. Checks also if any community is selected. * If no community is selected or any other field isn't valid @@ -424,7 +423,6 @@ export default { } }, - async removeImage(image) { let newImages = []; for (let i in this.item.images) { diff --git a/src/components/RentingComponents/ItemInfo.vue b/src/components/RentingComponents/ItemInfo.vue index b6fc63b..6df66e2 100644 --- a/src/components/RentingComponents/ItemInfo.vue +++ b/src/components/RentingComponents/ItemInfo.vue @@ -227,8 +227,7 @@ export default { ); if (isNaN(maybeRating)) { this.rating = NaN; - } - else { + } else { this.rating = maybeRating; if (this.rating > 5) this.rating = 5; else if (this.rating < 1) this.rating = 1; diff --git a/src/views/ItemViews/EditItemView.vue b/src/views/ItemViews/EditItemView.vue index cdb4f27..6ae7176 100644 --- a/src/views/ItemViews/EditItemView.vue +++ b/src/views/ItemViews/EditItemView.vue @@ -1,7 +1,7 @@ <template> <!-- A view for editing the item --> <div class="h-screen grid md:mt-8"> - <edit-item-form/> + <edit-item-form /> </div> </template> diff --git a/tests/unit/component-tests/renting-compnents-tests/new-rent.spec.js b/tests/unit/component-tests/renting-compnents-tests/new-rent.spec.js index c4cb88e..458147e 100644 --- a/tests/unit/component-tests/renting-compnents-tests/new-rent.spec.js +++ b/tests/unit/component-tests/renting-compnents-tests/new-rent.spec.js @@ -7,8 +7,8 @@ let mockRouter; describe("Confirm and send a rent request", () => { mockRouter = { - go: jest.fn() - } + go: jest.fn(), + }; let wrapper; beforeEach(() => { @@ -24,11 +24,11 @@ describe("Confirm and send a rent request", () => { isAccepted: false, }, }, - global:{ - mocks:{ - $router: mockRouter - } - } + global: { + mocks: { + $router: mockRouter, + }, + }, }); }); @@ -51,11 +51,11 @@ describe("Confirm and send a rent request", () => { expect(axios.post).toHaveBeenCalledTimes(1); }); - it("Checks that page is reloaded when cancelButton is press", async () =>{ + it("Checks that page is reloaded when cancelButton is press", async () => { const button = wrapper.find("#cancelButton"); button.trigger("click"); await wrapper.vm.$nextTick(); expect(mockRouter.go).toHaveBeenCalledTimes(1); expect(mockRouter.go).toHaveBeenCalledWith(0); - }) + }); }); -- GitLab