Fixed tests
All checks were successful
Production PR / QA Tests (pull_request) Successful in 44s

This commit is contained in:
Liviu Burcusel 2026-01-12 11:47:38 +01:00
parent a7f75868cf
commit 414aea1cbd
Signed by: liviu
GPG key ID: 6CDB37A4AD2C610C
5 changed files with 17 additions and 7 deletions

View file

@ -166,7 +166,7 @@ describe("SidebarFooter.vue", () => {
expect(wrapper.text()).not.toContain("Log out"); expect(wrapper.text()).not.toContain("Log out");
}); });
it("calls navigateTo('/member/auth/logout') when Log out is clicked", async () => { it("calls navigateTo('/auth/logout') when Log out is clicked", async () => {
const wrapper = mount(SidebarFooterComponent, { const wrapper = mount(SidebarFooterComponent, {
props: { user }, props: { user },
global: { global: {
@ -181,10 +181,10 @@ describe("SidebarFooter.vue", () => {
expect(logoutItem).toBeDefined(); expect(logoutItem).toBeDefined();
await logoutItem?.trigger("click"); await logoutItem?.trigger("click");
expect(navigateToMock).toHaveBeenCalledWith("/member/auth/logout"); expect(navigateToMock).toHaveBeenCalledWith("/auth/logout");
}); });
it("calls navigateTo('/member/auth/login') when Log in is clicked", async () => { it("calls navigateTo('/auth/login') when Log in is clicked", async () => {
const wrapper = mount(SidebarFooterComponent, { const wrapper = mount(SidebarFooterComponent, {
props: { user: null }, props: { user: null },
global: { global: {
@ -199,7 +199,7 @@ describe("SidebarFooter.vue", () => {
expect(loginItem).toBeDefined(); expect(loginItem).toBeDefined();
await loginItem?.trigger("click"); await loginItem?.trigger("click");
expect(navigateToMock).toHaveBeenCalledWith("/member/auth/login"); expect(navigateToMock).toHaveBeenCalledWith("/auth/login");
}); });
it("computes initials correctly for single name", () => { it("computes initials correctly for single name", () => {

View file

@ -1,6 +1,6 @@
import { mount, flushPromises } from "@vue/test-utils"; import { mount, flushPromises } from "@vue/test-utils";
import { describe, it, expect, vi, beforeEach } from "vitest"; import { describe, it, expect, vi, beforeEach } from "vitest";
import CreateAccountPage from "~/pages/member/auth/create-account.vue"; import CreateAccountPage from "~/pages/auth/create-account.vue";
// Mock auth client // Mock auth client
const authMocks = vi.hoisted(() => ({ const authMocks = vi.hoisted(() => ({

View file

@ -1,6 +1,6 @@
import { mount, flushPromises } from "@vue/test-utils"; import { mount, flushPromises } from "@vue/test-utils";
import { describe, expect, it, vi, beforeEach, beforeAll, afterAll } from "vitest"; import { describe, expect, it, vi, beforeEach, beforeAll, afterAll } from "vitest";
import LoginPage from "~/pages/member/auth/login.vue"; import LoginPage from "~/pages/auth/login.vue";
// Mock the auth store // Mock the auth store
const authStoreMocks = vi.hoisted(() => ({ const authStoreMocks = vi.hoisted(() => ({

View file

@ -1,6 +1,6 @@
import { mount, flushPromises } from "@vue/test-utils"; import { mount, flushPromises } from "@vue/test-utils";
import { describe, expect, it, vi, beforeEach, beforeAll, afterAll } from "vitest"; import { describe, expect, it, vi, beforeEach, beforeAll, afterAll } from "vitest";
import LogoutPage from "~/pages/member/auth/logout.vue"; import LogoutPage from "~/pages/auth/logout.vue";
// Mock the auth store // Mock the auth store
const mocks = vi.hoisted(() => ({ const mocks = vi.hoisted(() => ({

View file

@ -18,6 +18,16 @@ Object.defineProperty(global, "import", {
writable: true, writable: true,
}); });
const breadcrumbStoreMocks = vi.hoisted(() => ({
setBreadcrumbs: vi.fn(),
addBreadcrumb: vi.fn(),
clear: vi.fn(),
items: [{ label: "Auth" }, { label: "Create Account", to: "/auth/create-account" }],
}));
vi.mock("~/stores/breadcrumbs", () => ({
useBreadcrumbStore: () => breadcrumbStoreMocks,
}));
config.global.stubs = { config.global.stubs = {
NuxtLayout: true, NuxtLayout: true,
NuxtPage: true, NuxtPage: true,