test(webapp): seed the visual login session in indicadores specs
The indicadores navigation, sections and cancer-journey specs routed through the real routes without a session, so authGuard redirected to LoginPage. Add auth.testing helpers that seed and clear the sessionStorage session, use them in those specs, and add a spec that /indicadores/<dominio> without a session presents LoginPage with returnUrl.
This commit is contained in:
@@ -6,6 +6,7 @@ import { provideRouter } from '@angular/router';
|
||||
import { RouterTestingHarness } from '@angular/router/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { routes } from '../../app.routes';
|
||||
import { iniciarSesionVisual, limpiarSesionVisual } from '../../auth/auth.testing';
|
||||
import { IndicadoresPage } from './indicadores-page';
|
||||
import { IndicadoresDefinitions } from './indicadores-definitions';
|
||||
import { IndicadorCatalogCard } from './indicador-catalog-card';
|
||||
@@ -24,12 +25,13 @@ const catalog: Indicador[] = [
|
||||
describe('Secciones compartidas por dominio', () => {
|
||||
let http: HttpTestingController;
|
||||
beforeEach(() => {
|
||||
iniciarSesionVisual();
|
||||
vi.stubGlobal('IntersectionObserver', class { observe() {} unobserve() {} disconnect() {} });
|
||||
TestBed.configureTestingModule({ providers: [provideRouter(routes), provideHttpClient(), provideHttpClientTesting(), periodAvailabilityProvider, kpiQueriesProvider] });
|
||||
TestBed.overrideComponent(IndicadorFigureCard, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } });
|
||||
http = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
afterEach(() => { http.verify(); vi.restoreAllMocks(); vi.unstubAllGlobals(); });
|
||||
afterEach(() => { http.verify(); vi.restoreAllMocks(); vi.unstubAllGlobals(); limpiarSesionVisual(); });
|
||||
|
||||
it.each(DOMINIOS)('entrada directa en %s presenta sus pestañas y Resumen seleccionado', async domain => {
|
||||
const harness = await RouterTestingHarness.create();
|
||||
|
||||
Reference in New Issue
Block a user