import { Usuario } from './auth.service'; /** Same key AuthService persists the visual session under. */ const CLAVE_SESION = 'isssteleon.sesion'; /** * Seeds the browser-only visual session before the router and AuthService are created, * so routes behind authGuard render instead of redirecting to /login. Pair every call * with `limpiarSesionVisual()` in afterEach so the session never leaks between tests. */ export function iniciarSesionVisual(sesion: Usuario = { usuario: 'admin', nombre: 'Administrador', dominios: ['cacu', 'cama', 'tea'] }): void { sessionStorage.setItem(CLAVE_SESION, JSON.stringify(sesion)); } export function limpiarSesionVisual(): void { sessionStorage.removeItem(CLAVE_SESION); }