From 902a3738462b8fb64ba93262d41546f593f29f94 Mon Sep 17 00:00:00 2001 From: Gilgard <Hjelljord.alida@gmail.com> Date: Fri, 29 Apr 2022 12:25:38 +0200 Subject: [PATCH] fix tests after merge --- .../community-header.spec.js.snap | 36 ++- .../community-list-item.spec.js.snap | 72 +++-- .../__snapshots__/community-list.spec.js.snap | 70 +---- .../__snapshots__/item-card.spec.js.snap | 2 +- .../__snapshots__/member-list.spec.js.snap | 250 ------------------ .../community-list-item.spec.js | 5 +- .../member-list.spec.js | 18 -- 7 files changed, 75 insertions(+), 378 deletions(-) delete mode 100644 tests/unit/component-tests/community-component-tests/__snapshots__/member-list.spec.js.snap delete mode 100644 tests/unit/component-tests/community-component-tests/member-list.spec.js diff --git a/tests/unit/component-tests/base-component-tests/__snapshots__/community-header.spec.js.snap b/tests/unit/component-tests/base-component-tests/__snapshots__/community-header.spec.js.snap index 37c7707..7384710 100644 --- a/tests/unit/component-tests/base-component-tests/__snapshots__/community-header.spec.js.snap +++ b/tests/unit/component-tests/base-component-tests/__snapshots__/community-header.spec.js.snap @@ -35,29 +35,27 @@ exports[`CommunityHeader component renders correctly 1`] = ` </div> </div> </div> - <div - class="flex" - > + <div> <span class="hidden sm:block" > - <button - class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" - type="button" + <!-- Legg dette til i button: v-if="adminStatus" --> + <svg + class="w-9 h-9 cursor-pointer" + fill="none" + stroke="currentColor" + viewBox="0 0 24 24" + xmlns="http://www.w3.org/2000/svg" > - <!-- Heroicon name: solid/pencil --> - <svg - class="h-5 w-5" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z" - /> - </svg> - Edit - </button> + <path + d="M4 6h16M4 12h16M4 18h16" + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + /> + </svg> + <!--v-if--> + <!-- class="absolute" --> </span> </div> </div> diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap index c68960a..25c734a 100644 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap @@ -2,34 +2,64 @@ exports[`CommunityListItem component renders correctly 1`] = ` <div - class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" + data-v-app="" > + + + <!-- Main modal --> + <!--v-if--> + <div - class="h-10 w-10 flex flex-col justify-center items-center mr-4" - > - <img - alt="groupIMG" - src="" - /> - </div> - <div - class="flex-1 pl-1" + class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" > <div - class="font-medium dark:text-white" + class="h-10 w-10 flex flex-col justify-center items-center mr-4" > - string + <svg + aria-hidden="true" + fill="none" + stroke="currentColor" + stroke-width="2" + viewBox="0 0 24 24" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" + stroke-linecap="round" + stroke-linejoin="round" + /> + </svg> + <!-- TODO: USE COMMUNITY IMAGE <img alt="Felleskapets bilde" src="@/assets/group.png" /> --> </div> - </div> - <div - class="flex flex-row justify-center" - > - <!--v-if--> - <button - class="px-4 py-2 w-24 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80" + <div + class="flex-1 pl-1 overflow-hidden" > - GÃ¥ til - </button> + <div + class="font-medium dark:text-white truncate" + > + string + </div> + </div> + <div + class="flex flex-row justify-center items-center" + > + <svg + aria-hidden="true" + class="max-h-6 max-w-6 shrink m-2" + fill="none" + stroke="currentColor" + stroke-width="2" + viewBox="0 0 24 24" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" + stroke-linecap="round" + stroke-linejoin="round" + /> + </svg> + </div> </div> + </div> `; diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list.spec.js.snap index 5f9cb2a..0feda82 100644 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list.spec.js.snap +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list.spec.js.snap @@ -1,74 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CommunityList component renders correctly 1`] = ` -<ul> +<ul + grouplist="[object Object],[object Object]" +> - <li> - <div - class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" - > - <div - class="h-10 w-10 flex flex-col justify-center items-center mr-4" - > - <img - alt="groupIMG" - src="" - /> - </div> - <div - class="flex-1 pl-1" - > - <div - class="font-medium dark:text-white" - > - string - </div> - </div> - <div - class="flex flex-row justify-center" - > - <!--v-if--> - <button - class="px-4 py-2 w-24 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80" - > - GÃ¥ til - </button> - </div> - </div> - </li> - <li> - <div - class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" - > - <div - class="h-10 w-10 flex flex-col justify-center items-center mr-4" - > - <img - alt="groupIMG" - src="" - /> - </div> - <div - class="flex-1 pl-1" - > - <div - class="font-medium dark:text-white" - > - string - </div> - </div> - <div - class="flex flex-row justify-center" - > - <!--v-if--> - <button - class="px-4 py-2 w-24 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80" - > - GÃ¥ til - </button> - </div> - </div> - </li> </ul> `; diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/item-card.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/item-card.spec.js.snap index c306628..a676545 100644 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/item-card.spec.js.snap +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/item-card.spec.js.snap @@ -31,7 +31,7 @@ exports[`ItemCard component renders correctly 1`] = ` class="text-gray-700 text-xs" id="price" > - 0 kr + 0 kr </p> </div> </div> diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/member-list.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/member-list.spec.js.snap deleted file mode 100644 index d6fe3f3..0000000 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/member-list.spec.js.snap +++ /dev/null @@ -1,250 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`MemberList component renders correctly 1`] = ` -<ul> - - <li> - <div - class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" - > - <div - class="h-10 w-10 flex flex-col justify-center items-center mr-4" - > - <router-link - to="/profile/2" - > - <img - alt="profil" - src="" - /> - </router-link> - </div> - <div - class="flex-1 pl-1" - > - <div - class="font-medium dark:text-white" - > - erik hansen - </div> - </div> - <div - class="hidden md:block flex-auto" - > - <ul - class="flex justify-center" - > - <li> - <p - class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400" - > - Gjennomsnitts rating:Â - </p> - </li> - - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - - <li> - <p - class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400" - > - "[object Promise]" out of 5 - </p> - </li> - </ul> - </div> - <div - class="flex flex-row justify-center" - > - <button - class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80" - > - Ã…pne chat - </button> - <!--v-if--> - </div> - </div> - </li> - <li> - <div - class="bg-white shadow dark:bg-gray-800 select-none cursor-pointer hover:bg-gray-50 flex items-center p-4" - > - <div - class="h-10 w-10 flex flex-col justify-center items-center mr-4" - > - <router-link - to="/profile/1" - > - <img - alt="profil" - src="" - /> - </router-link> - </div> - <div - class="flex-1 pl-1" - > - <div - class="font-medium dark:text-white" - > - Test Testesen - </div> - </div> - <div - class="hidden md:block flex-auto" - > - <ul - class="flex justify-center" - > - <li> - <p - class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400" - > - Gjennomsnitts rating:Â - </p> - </li> - - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - <li> - <svg - class="w-5 h-5 text-gray-300 dark:text-gray-500" - fill="currentColor" - viewBox="0 0 20 20" - xmlns="http://www.w3.org/2000/svg" - > - <path - d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" - /> - </svg> - </li> - - <li> - <p - class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400" - > - "[object Promise]" out of 5 - </p> - </li> - </ul> - </div> - <div - class="flex flex-row justify-center" - > - <button - class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80" - > - Ã…pne chat - </button> - <!--v-if--> - </div> - </div> - </li> - -</ul> -`; diff --git a/tests/unit/component-tests/community-component-tests/community-list-item.spec.js b/tests/unit/component-tests/community-component-tests/community-list-item.spec.js index 5349b43..177ad07 100644 --- a/tests/unit/component-tests/community-component-tests/community-list-item.spec.js +++ b/tests/unit/component-tests/community-component-tests/community-list-item.spec.js @@ -8,14 +8,15 @@ describe("CommunityListItem component", () => { wrapper = mount(CommunityListItem, { //passing prop to component props: { - group: { + community: { communityId: 0, name: "string", description: "string", visibility: 0, location: "string", picture: "string" - } + }, + member: false, } }); }); diff --git a/tests/unit/component-tests/community-component-tests/member-list.spec.js b/tests/unit/component-tests/community-component-tests/member-list.spec.js deleted file mode 100644 index 4a846eb..0000000 --- a/tests/unit/component-tests/community-component-tests/member-list.spec.js +++ /dev/null @@ -1,18 +0,0 @@ -import { mount } from "@vue/test-utils"; -import MemberList from "@/components/CommunityComponents/MemberList.vue" - -describe("MemberList component", () => { - let wrapper; - - beforeEach(() => { - wrapper = mount(MemberList); - }); - - it("renders correctly", () => { - expect(wrapper.element).toMatchSnapshot(); - }); - - it("is instantiated", () => { - expect(wrapper.exists()).toBeTruthy(); - }); -}); \ No newline at end of file -- GitLab