Unit Tests for Angular 2 Applications
summary
Angular 2 unit testing focuses on concrete tools and recipes: use the testing module and TestBed.compileComponents to precompile templates, choose between real async (zones and fixture.whenStable) or fakeAsync/tick for controlled timing, get fixtures and call detectChanges to update the DOM, query with DebugElement or nativeElement, replace HTTP with MockBackend to control responses, and use RouterTestingModule or shallow stub components to keep tests isolated and fast.
AI-written summary · about
chapters (10)
- 0:00Introduction to testing
- 1:10Changes in Angular 2 testing
- 3:21Deciding testing approach
- 7:56Locating elements in tests
- 9:21Testing simple components
- 13:59Mocking services in tests
- 18:36Handling async operations
- 21:04Testing services with HTTP
- 22:29Testing routing setup
- 24:42Testing nested components
related talks
59mTechniques and practices for testing Angular 2
56mAngular Unit Testing from the Trenches
19mTesting Best Practices for Angular Applications
13mTesting Angular Components Fundamentals
56mTechniques and practices for testing Angular
52mAngular Testing: Do I Really Have to Do It?!
25mAngular + Jest: Testing Titbits
19mModern Testing Strategies for Reactive Applications
