Unit, Component, Service and HTTP Testing
Learn Unit, Component, Service and HTTP Testing (Phase 13 · Testing and Deployment (Production), Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What to test and how • Angular's TestBed creates a testing module/environment for components and services. Test behaviour : what the user sees and what a service returns, not private implementation. • Service tests are plain unit tests: create the service ( TestBed.inject ), call methods and assert. Provide fakes for dependencies: { provide: CourseApi, useValue: fakeApi } . • Pure code (pipes, validators, reducers, utility functions) needs no TestBed: instantiate and call.