import { describe, it, expect, vi, beforeEach } from 'vitest' describe('router multitenant routing', () => { beforeEach(() => { vi.resetModules() delete (process.env as any).VUE_APP_MULTITENANT_ENABLED }) it('includes public routes and legacy flat routes when flag disabled', async () => { const { createAppRouter } = await import('@/router/index') const router = createAppRouter(() => null) const paths = router.getRoutes().map((r) => r.path) expect(paths).toContain('/login') expect(paths).toContain('/create-account') expect(paths).toContain('/welcome') expect(paths).toContain('/invitations/accept') // legacy flat routes expect(paths).toContain('/recipes') expect(paths).toContain('/shopping') }) it('nests routes under /:householdSlug when flag enabled', async () => { (process.env as any).VUE_APP_MULTITENANT_ENABLED = 'true' const { createAppRouter } = await import('@/router/index') const router = createAppRouter(() => null) const paths = router.getRoutes().map((r) => r.path) // Public routes still exist expect(paths).toContain('/login') expect(paths).toContain('/create-account') // Nested route example const hasNestedRecipes = paths.some((p) => p === '/:householdSlug/recipes') expect(hasNestedRecipes).toBe(true) // Legacy route should not be present when nested is enabled expect(paths).not.toContain('/recipes') }) })