CodeZettaInterview Hub

Angular · Testing · Tech Lead · Live Coding

How do you unit test an Angular component with TestBed?

Short Interview Answer

Configure TestBed with the component and stubs, create fixture, detectChanges, assert DOM/state.

Detailed Explanation

Prefer shallow tests with mocked services. Use harnesses for CDK. Prefer testing library queries for a11y-friendly asserts.

Did you know this answer?