From f50267bfc1aef72c9d6c4aa84d86f4fad5213f7d Mon Sep 17 00:00:00 2001
From: Gilgard <Hjelljord.alida@gmail.com>
Date: Wed, 27 Apr 2022 10:01:25 +0200
Subject: [PATCH] lint

---
 src/components/HelloWorld.vue         |  6 +-
 tests/unit/apiutil-login-mock.spec.js | 29 ++++++----
 tests/unit/create-new-group.spec.js   | 83 +++++++++++++--------------
 tests/unit/search-item-list.spec.js   | 15 ++---
 4 files changed, 65 insertions(+), 68 deletions(-)

diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
index ecc5bf6..cd62d11 100644
--- a/src/components/HelloWorld.vue
+++ b/src/components/HelloWorld.vue
@@ -12,8 +12,6 @@
 export default {
   name: "HelloWorld",
 
-  data: () => ({
-
-}),
-}
+  data: () => ({}),
+};
 </script>
diff --git a/tests/unit/apiutil-login-mock.spec.js b/tests/unit/apiutil-login-mock.spec.js
index b6d573b..d7c12c9 100644
--- a/tests/unit/apiutil-login-mock.spec.js
+++ b/tests/unit/apiutil-login-mock.spec.js
@@ -4,14 +4,13 @@ import axios from "axios";
 jest.mock("axios");
 
 describe("testing mocking of apiutil.js", () => {
-
   it("check that login fails with wrong credentials - against mock", async () => {
-
     const loginRequest = {
       email: "wrong@email.com",
-      password: "thisiswrong123"};
+      password: "thisiswrong123",
+    };
 
-    const expectedLoginResponse = { isLoggedIn: false, token: "" }
+    const expectedLoginResponse = { isLoggedIn: false, token: "" };
 
     axios.post.mockImplementation(() =>
       Promise.resolve({ data: expectedLoginResponse })
@@ -19,24 +18,32 @@ describe("testing mocking of apiutil.js", () => {
 
     const loginResponse = await doLogin(loginRequest);
 
-    expect(loginResponse.token.isLoggedIn).toEqual(expectedLoginResponse.isLoggedIn);
+    expect(loginResponse.token.isLoggedIn).toEqual(
+      expectedLoginResponse.isLoggedIn
+    );
   });
 
   it("check that login succeeds when correct credentials - against mock", async () => {
-
     const loginRequest = {
       email: "correct@email.com",
-      password: "thisiscorrect123"};
+      password: "thisiscorrect123",
+    };
 
-    const apiResponse = {isLoggedIn: true, token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM" +
-          "0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"};
+    const apiResponse = {
+      isLoggedIn: true,
+      token:
+        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM" +
+        "0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
+    };
 
-    const expectedLoginResponse = {isLoggedIn: false, token: ""};
+    const expectedLoginResponse = { isLoggedIn: false, token: "" };
 
     axios.post.mockImplementation(() => Promise.resolve({ data: apiResponse }));
 
     const loginResponse = await doLogin(loginRequest);
 
-    expect(loginResponse.token.isLoggedIn).not.toEqual(expectedLoginResponse.isLoggedIn);
+    expect(loginResponse.token.isLoggedIn).not.toEqual(
+      expectedLoginResponse.isLoggedIn
+    );
   });
 });
diff --git a/tests/unit/create-new-group.spec.js b/tests/unit/create-new-group.spec.js
index 2b269b0..dfdceef 100644
--- a/tests/unit/create-new-group.spec.js
+++ b/tests/unit/create-new-group.spec.js
@@ -2,48 +2,43 @@ import { shallowMount } from "@vue/test-utils";
 import CreateNewGroup from "@/components/CreateNewGroup.vue";
 
 describe("CreateNewGroup elements rendering", () => {
-
-    it("renders all labels", () => {
-
-        const wrapper = shallowMount(CreateNewGroup);
-
-        expect(wrapper.find('#radioBoxLabel').text()).toMatch("Synlighet");
-        expect(wrapper.find('#radioBoxOpenLabel').text()).toMatch("Ã…pen");
-        expect(wrapper.find('#radioBoxPrivateLabel').text()).toMatch("Privat");
-        expect(wrapper.find('#titleLabel').text()).toMatch("Gruppenavn");
-        expect(wrapper.find('#selectCategoryLabel').text()).toMatch("Kategori");
-        expect(wrapper.find('#descriptionLabel').text()).toMatch("Beskrivelse");
-        expect(wrapper.find('#imageLabel').text()).toMatch("Bilde");
-
-    });
-
-    it("Tests setting values of input field", async() => {
-
-        const wrapper = shallowMount(CreateNewGroup);
-
-        const titleInput = wrapper.find('#title');
-        await titleInput.setValue("Fjellgata");
-        expect(titleInput.element.value).toBe("Fjellgata");
-
-        const selectedCategory = wrapper.find('#categories');
-        await selectedCategory.setValue("Borettslag");
-        expect(selectedCategory.element.value).toBe("Borettslag");
-
-        const descriptionInput = wrapper.find('#description');
-        await descriptionInput.setValue("Dette er et borettslag");
-        expect(descriptionInput.element.value).toBe("Dette er et borettslag");
-    });
-
-    it("Tests if radio box checks", async() => {
-
-        const wrapper = shallowMount(CreateNewGroup);
-
-        const radioInputOpen = wrapper.find('#flexRadioOpen');
-        await radioInputOpen.setChecked();
-        expect(radioInputOpen.element.checked).toBeTruthy();
-
-        const radioInputPrivate = wrapper.find('#flexRadioPrivate');
-        await radioInputPrivate.setChecked();
-        expect(radioInputPrivate.element.checked).toBeTruthy();
-    });
+  it("renders all labels", () => {
+    const wrapper = shallowMount(CreateNewGroup);
+
+    expect(wrapper.find("#radioBoxLabel").text()).toMatch("Synlighet");
+    expect(wrapper.find("#radioBoxOpenLabel").text()).toMatch("Ã…pen");
+    expect(wrapper.find("#radioBoxPrivateLabel").text()).toMatch("Privat");
+    expect(wrapper.find("#titleLabel").text()).toMatch("Gruppenavn");
+    expect(wrapper.find("#selectCategoryLabel").text()).toMatch("Kategori");
+    expect(wrapper.find("#descriptionLabel").text()).toMatch("Beskrivelse");
+    expect(wrapper.find("#imageLabel").text()).toMatch("Bilde");
+  });
+
+  it("Tests setting values of input field", async () => {
+    const wrapper = shallowMount(CreateNewGroup);
+
+    const titleInput = wrapper.find("#title");
+    await titleInput.setValue("Fjellgata");
+    expect(titleInput.element.value).toBe("Fjellgata");
+
+    const selectedCategory = wrapper.find("#categories");
+    await selectedCategory.setValue("Borettslag");
+    expect(selectedCategory.element.value).toBe("Borettslag");
+
+    const descriptionInput = wrapper.find("#description");
+    await descriptionInput.setValue("Dette er et borettslag");
+    expect(descriptionInput.element.value).toBe("Dette er et borettslag");
+  });
+
+  it("Tests if radio box checks", async () => {
+    const wrapper = shallowMount(CreateNewGroup);
+
+    const radioInputOpen = wrapper.find("#flexRadioOpen");
+    await radioInputOpen.setChecked();
+    expect(radioInputOpen.element.checked).toBeTruthy();
+
+    const radioInputPrivate = wrapper.find("#flexRadioPrivate");
+    await radioInputPrivate.setChecked();
+    expect(radioInputPrivate.element.checked).toBeTruthy();
+  });
 });
diff --git a/tests/unit/search-item-list.spec.js b/tests/unit/search-item-list.spec.js
index 6a01bbb..b7d0fba 100644
--- a/tests/unit/search-item-list.spec.js
+++ b/tests/unit/search-item-list.spec.js
@@ -2,14 +2,11 @@ import { shallowMount } from "@vue/test-utils";
 import SearchItemListComponent from "@/components/SearchItemListComponent.vue";
 
 describe("CreateNewGroup elements rendering", () => {
+  it("Tests setting values of input field", async () => {
+    const wrapper = shallowMount(SearchItemListComponent);
 
-    it("Tests setting values of input field", async() => {
-
-        const wrapper = shallowMount(SearchItemListComponent);
-
-        const searchInput = wrapper.find('#searchInput');
-        await searchInput.setValue("Dyson");
-        expect(searchInput.element.value).toBe("Dyson");
-
-    });
+    const searchInput = wrapper.find("#searchInput");
+    await searchInput.setValue("Dyson");
+    expect(searchInput.element.value).toBe("Dyson");
+  });
 });
-- 
GitLab