mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
feat(core): remove TestBed.get (#60414)
`TestBed.get` isn't type safe and has been deprecated for several years now. These changes remove it from the public API and a follow-up change will add an automated migration to `TestBed.inject`. BREAKING CHANGE: * `TestBed.get` has been removed. Use `TestBed.inject` instead. PR Close #60414
This commit is contained in:
committed by
Pawel Kozlowski
parent
b461e06ecb
commit
5e209cb560
@@ -79,7 +79,7 @@ class ReentrantInterceptor implements HttpInterceptor {
|
||||
describe('HttpClientModule', () => {
|
||||
let injector: Injector;
|
||||
beforeEach(() => {
|
||||
injector = TestBed.configureTestingModule({
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [
|
||||
{provide: HTTP_INTERCEPTORS, useClass: InterceptorA, multi: true},
|
||||
@@ -87,6 +87,7 @@ describe('HttpClientModule', () => {
|
||||
{provide: HTTP_INTERCEPTORS, useClass: InterceptorC, multi: true},
|
||||
],
|
||||
});
|
||||
injector = TestBed.inject(Injector);
|
||||
});
|
||||
it('initializes HttpClient properly', (done) => {
|
||||
injector
|
||||
@@ -132,10 +133,11 @@ describe('HttpClientModule', () => {
|
||||
});
|
||||
it('allows interceptors to inject HttpClient', (done) => {
|
||||
TestBed.resetTestingModule();
|
||||
injector = TestBed.configureTestingModule({
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [{provide: HTTP_INTERCEPTORS, useClass: ReentrantInterceptor, multi: true}],
|
||||
});
|
||||
injector = TestBed.inject(Injector);
|
||||
injector
|
||||
.get(HttpClient)
|
||||
.get('/test')
|
||||
|
||||
Reference in New Issue
Block a user