diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..2a19e2dd60fb8ab15c60271cc4de05441a2c19ff --- /dev/null +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`CommunityHeader component renders correctly 1`] = ` +<div + class="flex items-center justify-between mx-4" +> + <router-link + class="flex-1 min-w-0" + to="/community/1" + > + <h2 + class="text-2xl font-bold leading-7 text-gray-900 sm:text-3xl sm:truncate" + > + String + </h2> + <div + class="mt-1 flex flex-col sm:flex-row sm:flex-wrap sm:mt-0 sm:space-x-6" + > + <div + class="mt-2 flex items-center text-sm text-gray-500" + > + <svg + aria-hidden="true" + class="flex-shrink-0 mr-1.5 h-5 w-5 text-gray-400" + fill="currentColor" + viewBox="0 0 20 20" + xmlns="http://www.w3.org/2000/svg" + > + <path + clip-rule="evenodd" + d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" + fill-rule="evenodd" + /> + </svg> + String + </div> + </div> + </router-link> + <div> + <!-- If the user is not a member in the community, this button will show --> + <!--v-if--> + <!-- If the user is member of the community, this hamburger menu will show --> + <div> + <svg + class="w-9 h-9 cursor-pointer" + fill="none" + stroke="currentColor" + viewBox="0 0 24 24" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M4 6h16M4 12h16M4 18h16" + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + /> + </svg> + <!--v-if--> + <!-- class="absolute" --> + </div> + </div> +</div> +`; diff --git a/tests/unit/component-tests/base-component-tests/community-header.spec.js b/tests/unit/component-tests/community-component-tests/community-header.spec.js similarity index 69% rename from tests/unit/component-tests/base-component-tests/community-header.spec.js rename to tests/unit/component-tests/community-component-tests/community-header.spec.js index e39577dd3a53015fa527e48e1b9cf913081963ff..84c03bcf42a854598edb236b4de23f26a902507e 100644 --- a/tests/unit/component-tests/base-component-tests/community-header.spec.js +++ b/tests/unit/component-tests/community-component-tests/community-header.spec.js @@ -1,5 +1,6 @@ import { mount } from "@vue/test-utils"; import CommunityHeader from "@/components/CommunityComponents/CommunityHeader.vue"; +import { route, router, $route, $router } from "../../mock-router" describe("CommunityHeader component", () => { let wrapper; @@ -18,9 +19,21 @@ describe("CommunityHeader component", () => { picture: "String", }, }, + global: { + mocks: { + route, + router, + $route, + $router, + } + } }); }); + it("renders correctly", () => { + expect(wrapper.element).toMatchSnapshot(); + }); + it("is instantiated", () => { expect(wrapper.exists()).toBeTruthy(); });