feat: implement store layout and home page components with routing

This commit is contained in:
2026-06-26 13:42:23 -03:00
parent 236a3772a4
commit 23e8da345a
12 changed files with 715 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import { TestBed } from '@angular/core/testing';
import { provideRouter, Router } from '@angular/router';
import { App } from './app';
import { routes } from './app.routes';
async function renderAppAt(url: string) {
TestBed.resetTestingModule();
await TestBed.configureTestingModule({
imports: [App],
providers: [provideRouter(routes)]
}).compileComponents();
const router = TestBed.inject(Router);
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
await router.navigateByUrl(url);
await fixture.whenStable();
fixture.detectChanges();
return { fixture, router };
}
describe('app routes', () => {
it('loads the store layout at /store', async () => {
const { fixture, router } = await renderAppAt('/store');
const compiled = fixture.nativeElement as HTMLElement;
expect(router.url).toBe('/store');
expect(compiled.querySelector('.store-layout')).not.toBeNull();
expect(compiled.querySelector('.store-home')).not.toBeNull();
expect(compiled.textContent).toContain('Tienda en construccion');
});
it('keeps the root redirect under componentes-test', async () => {
const { fixture, router } = await renderAppAt('/');
const compiled = fixture.nativeElement as HTMLElement;
expect(router.url).toBe('/componentes-test/reutilizables');
expect(compiled.textContent).toContain('Componentes reutilizables');
});
});