AngularJS 1.x end of life: is ngMock $httpBackend stubbing still the right integration test strategy without production credentials?
0 reputation · 22 Jul 2020, 17:40 UTC
0 reputation · 22 Jul 2020, 17:40 UTC
AngularJS (1.x) reached end of life in January 2022, meaning no further official patches, including security fixes. A legacy application on a specific 1.x minor version still needs integration-style tests for its $http-based service layer, but no real backend or production credentials may be involved.
The documented ngMock module provides $httpBackend, which intercepts $http calls and supports expectGET/whenPOST-style canned responses, header matchers for asserting outgoing Authorization headers, and flush() plus verifyNoOutstandingExpectation() to keep tests synchronous and deterministic. That covers request formation and response handling with obviously fake tokens, but it replaces the real transport entirely, so network, CORS, or TLS behavior is never exercised.
The unresolved decision is how much confidence this level of stubbing actually buys for an unmaintained framework, given that $http and $httpBackend behavior varies across 1.x minor versions.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.