feat: enhance tests with router, HTTP client, and animations support

This commit is contained in:
Jesus Navalon
2026-07-12 22:40:48 +02:00
parent cd2ddd3cb0
commit a66af1d056
11 changed files with 478 additions and 113 deletions
@@ -1,23 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { ProductImage } from './product-image';
describe('ProductImage', () => {
let component: ProductImage;
let fixture: ComponentFixture<ProductImage>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProductImage]
})
.compileComponents();
fixture = TestBed.createComponent(ProductImage);
component = fixture.componentInstance;
fixture.detectChanges();
beforeEach(() => {
TestBed.configureTestingModule({ imports: [ProductImage] });
});
it('should create', () => {
expect(component).toBeTruthy();
it('it renders the image with proper src and alt', () => {
const fixture = TestBed.createComponent(ProductImage);
fixture.componentRef.setInput('imgUrl', 'https://example.com/a.jpg');
fixture.componentRef.setInput('alt', 'Acer Iconia');
fixture.detectChanges();
const img: HTMLImageElement = fixture.nativeElement.querySelector('img');
expect(img.src).toBe('https://example.com/a.jpg');
expect(img.alt).toBe('Acer Iconia');
});
});