Cơ BảnAngular iconAngular

Angular TestBed dùng để làm gì?

TestBed tạo testing module/environment để render component, inject services và override providers trong unit test.

Nó hữu ích khi test component standalone, service có DI, provider override, pipe/directive hoặc behavior cần gần Angular runtime thật. Với logic thuần TypeScript không phụ thuộc Angular runtime, có thể test class/function trực tiếp để nhanh và ít boilerplate hơn.

Xem toàn bộ Angular cùng filter theo level & chủ đề con.

Mở danh sách Angular