/** * AppTopbar.spec.ts * * Strategy: mount with createPinia(); stub all PrimeVue components so we * test only the wiring of store actions to user interactions. * * Assertions: * 1. Hamburger click → shell.setMobileOpen(true) * 2. Theme toggle click → shell.setTheme with flipped value (light→dark, dark→light) * 3. Density toggle click → shell.setDensity with flipped value * 4. User-menu Sign out command → authStore.logout called * * useBreadcrumb() calls useRoute() internally. We provide a minimal * vue-router mock via vi.mock so the composable has a route to call. */ import { createPinia, setActivePinia } from 'pinia' import { mount } from '@vue/test-utils' import { beforeEach, describe, expect, it, vi } from 'vitest' import { useShellUiStore } from '@/stores/useShellUiStore' import { useAuthStore } from '@/stores/useAuthStore' // --------------------------------------------------------------------------- // Mock vue-router (useBreadcrumb calls useRoute internally) // --------------------------------------------------------------------------- vi.mock('vue-router', () => ({ useRoute: () => ({ matched: [], }), useRouter: () => ({}), })) // --------------------------------------------------------------------------- // Import component AFTER mocks // --------------------------------------------------------------------------- // eslint-disable-next-line import/first -- intentional: mocks must precede import import AppTopbar from '@/components-v2/layout/AppTopbar.vue' // --------------------------------------------------------------------------- // Stubs for PrimeVue components // --------------------------------------------------------------------------- const globalStubs = { Breadcrumb: { name: 'Breadcrumb', props: ['model'], template: '