Skip to content

Commit 21d3279

Browse files
committed
change deprecated 'TestBed.get' to 'TestBed.inject'
1 parent 99ae8af commit 21d3279

29 files changed

+59
-67
lines changed

src/app/modules/core/auth/auth.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ describe('AuthGuard should', () => {
4242
]
4343
}).compileComponents(); // compile template and css
4444

45-
authGuard = TestBed.get(AuthGuard);
46-
store = TestBed.get(Store);
45+
authGuard = TestBed.inject(AuthGuard);
46+
store = TestBed.inject(Store);
4747
});
4848

4949
it('allow logged in users to access route', () => {

src/app/modules/core/auth/auth.service.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ describe('AuthService', () => {
3737
]
3838
});
3939

40-
store = TestBed.get(Store);
41-
service = TestBed.get(AuthService);
42-
backend = TestBed.get(HttpTestingController);
40+
store = TestBed.inject(Store);
41+
service = TestBed.inject(AuthService);
42+
backend = TestBed.inject(HttpTestingController);
4343
});
4444

4545
afterEach(() => {

src/app/modules/core/auth/state/session.state.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ describe('State: SessionState', () => {
8383
]
8484
});
8585

86-
store = TestBed.get(Store);
87-
backend = TestBed.get(HttpTestingController);
88-
location = TestBed.get(Location);
86+
store = TestBed.inject(Store);
87+
backend = TestBed.inject(HttpTestingController);
88+
location = TestBed.inject(Location);
8989
});
9090

9191
afterEach(() => {

src/app/modules/core/core.module.ts

-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ import {BootProgressService, BootProgressServiceFactory} from './services/boot-p
110110
MyAccountComponent,
111111
BrowseComponent
112112
],
113-
entryComponents: [
114-
LoginDialogComponent,
115-
ConfirmDialogComponent
116-
],
117113
providers: [
118114
{
119115
provide: HTTP_INTERCEPTORS,

src/app/modules/core/dialogs/login/login.dialog.component.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Dialog: LoginDialogComponent', () => {
3737
});
3838

3939
fixture = TestBed.createComponent(LoginDialogComponent);
40-
store = TestBed.get(Store);
40+
store = TestBed.inject(Store);
4141
component = fixture.componentInstance;
4242
fixture.detectChanges();
4343
});

src/app/modules/core/guards/abstract-authority-guard.spec.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Guard: Abstract Authority Guard', () => {
2828
]
2929
}).compileComponents();
3030

31-
store = TestBed.get(Store);
31+
store = TestBed.inject(Store);
3232
store.reset(defaultSessionState);
3333
}));
3434

@@ -39,7 +39,7 @@ describe('Guard: Abstract Authority Guard', () => {
3939
state: 'authenticated'
4040
}));
4141

42-
TestBed.get(TestGuard).canActivate().subscribe((result: boolean) => {
42+
TestBed.inject(TestGuard).canActivate().subscribe((result: boolean) => {
4343
expect<boolean>(result).toBe(true);
4444
});
4545
});
@@ -51,7 +51,7 @@ describe('Guard: Abstract Authority Guard', () => {
5151
state: 'authenticated'
5252
}));
5353

54-
TestBed.get(TestGuard).canActivate().subscribe((result: boolean) => {
54+
TestBed.inject(TestGuard).canActivate().subscribe((result: boolean) => {
5555
expect<boolean>(result).toBe(false);
5656
});
5757
});
@@ -65,7 +65,7 @@ describe('Guard: Abstract Authority Guard', () => {
6565
state: 'authenticated'
6666
}));
6767

68-
TestBed.get(TestGuard).canActivate().subscribe((result: boolean) => {
68+
TestBed.inject(TestGuard).canActivate().subscribe((result: boolean) => {
6969
expect<boolean>(result).toBe(false);
7070
});
7171
});
@@ -80,7 +80,7 @@ describe('Guard: Abstract Authority Guard', () => {
8080
state: 'authenticated'
8181
}));
8282

83-
TestBed.get(TestAllAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
83+
TestBed.inject(TestAllAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
8484
expect<boolean>(result).toBe(true);
8585
});
8686
});
@@ -94,7 +94,7 @@ describe('Guard: Abstract Authority Guard', () => {
9494
state: 'authenticated'
9595
}));
9696

97-
TestBed.get(TestAllAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
97+
TestBed.inject(TestAllAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
9898
expect<boolean>(result).toBe(false);
9999
});
100100
});
@@ -108,7 +108,7 @@ describe('Guard: Abstract Authority Guard', () => {
108108
state: 'authenticated'
109109
}));
110110

111-
TestBed.get(TestAnyAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
111+
TestBed.inject(TestAnyAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
112112
expect<boolean>(result).toBe(true);
113113
});
114114
});
@@ -122,7 +122,7 @@ describe('Guard: Abstract Authority Guard', () => {
122122
state: 'authenticated'
123123
}));
124124

125-
TestBed.get(TestAnyAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
125+
TestBed.inject(TestAnyAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
126126
expect<boolean>(result).toBe(false);
127127
});
128128
});
@@ -137,7 +137,7 @@ describe('Guard: Abstract Authority Guard', () => {
137137
state: 'authenticated'
138138
}));
139139

140-
TestBed.get(TestCombineAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
140+
TestBed.inject(TestCombineAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
141141
expect<boolean>(result).toBe(true);
142142
});
143143
});
@@ -152,7 +152,7 @@ describe('Guard: Abstract Authority Guard', () => {
152152
state: 'authenticated'
153153
}));
154154

155-
TestBed.get(TestCombineAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
155+
TestBed.inject(TestCombineAuthoritiesGuard).canActivate().subscribe((result: boolean) => {
156156
expect<boolean>(result).toBe(false);
157157
});
158158
});

src/app/modules/core/pages/search/repository-search-results.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ describe('Component: RepositorySearchResultsComponent', () => {
3030
]
3131
});
3232

33-
httpClient = TestBed.get(HttpClient);
34-
httpTestingController = TestBed.get(HttpTestingController);
33+
httpClient = TestBed.inject(HttpClient);
34+
httpTestingController = TestBed.inject(HttpTestingController);
3535

3636
fixture = TestBed.createComponent(RepositorySearchResultsComponent);
3737
component = fixture.componentInstance;

src/app/modules/core/pages/search/repository-search.service.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ describe('RepositorySearchService', () => {
1717
}));
1818

1919
beforeEach(() => {
20-
service = TestBed.get(RepositorySearchService);
21-
backend = TestBed.get(HttpTestingController);
20+
service = TestBed.inject(RepositorySearchService);
21+
backend = TestBed.inject(HttpTestingController);
2222
});
2323

2424
afterEach(() => {

src/app/modules/core/services/boot-progress.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('BootProgressService', () => {
1616
}));
1717

1818
it('should be created', () => {
19-
const service: BootProgressService = TestBed.get(BootProgressService);
19+
const service: BootProgressService = TestBed.inject(BootProgressService);
2020
expect(service).toBeTruthy();
2121
});
2222
});

src/app/modules/core/services/interceptors/api-url.interceptor.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ describe('Interceptor: api-url interceptor', () => {
2323
]
2424
});
2525

26-
interceptor = TestBed.get(ApiURLInterceptor);
27-
backend = TestBed.get(HttpTestingController);
28-
client = TestBed.get(HttpClient);
26+
interceptor = TestBed.inject(ApiURLInterceptor);
27+
backend = TestBed.inject(HttpTestingController);
28+
client = TestBed.inject(HttpClient);
2929
});
3030

3131
afterEach(() => {

src/app/modules/core/services/interceptors/error.interceptor.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ describe('Interceptor: error interceptor', () => {
4343
]
4444
});
4545

46-
interceptor = TestBed.get(ErrorInterceptor);
47-
toastr = TestBed.get(ToastrService);
46+
interceptor = TestBed.inject(ErrorInterceptor);
47+
toastr = TestBed.inject(ToastrService);
4848
toastrSpy = spyOn(toastr, 'error').and.callThrough();
49-
backend = TestBed.get(HttpTestingController);
50-
client = TestBed.get(HttpClient);
51-
store = TestBed.get(Store);
52-
actions = TestBed.get(Actions);
49+
backend = TestBed.inject(HttpTestingController);
50+
client = TestBed.inject(HttpClient);
51+
store = TestBed.inject(Store);
52+
actions = TestBed.inject(Actions);
5353
}));
5454

5555
afterEach(() => {

src/app/modules/core/services/interceptors/token.interceptor.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ describe('Interceptor: token interceptor', () => {
2525
]
2626
});
2727

28-
interceptor = TestBed.get(TokenInterceptor);
29-
backend = TestBed.get(HttpTestingController);
30-
client = TestBed.get(HttpClient);
28+
interceptor = TestBed.inject(TokenInterceptor);
29+
backend = TestBed.inject(HttpTestingController);
30+
client = TestBed.inject(HttpClient);
3131

3232
let store = {};
3333
const mockLocalStorage = {

src/app/modules/environment-info/guards/view-environment-info.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ describe('Guard: ViewEnvironmentInfo', () => {
4545
]
4646
}).compileComponents(); // compile template and css
4747

48-
guard = TestBed.get(ViewEnvironmentInfoGuard);
49-
store = TestBed.get(Store);
48+
guard = TestBed.inject(ViewEnvironmentInfoGuard);
49+
store = TestBed.inject(Store);
5050
});
5151

5252
it('allow logged in users with ADMIN authority to access route', () => {

src/app/modules/environment-info/services/environment-info.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('EnvironmentInfoService', () => {
77
beforeEach(() => TestBed.configureTestingModule({imports: [HttpClientModule]}));
88

99
it('should be created', () => {
10-
const service: EnvironmentInfoService = TestBed.get(EnvironmentInfoService);
10+
const service: EnvironmentInfoService = TestBed.inject(EnvironmentInfoService);
1111
expect(service).toBeTruthy();
1212
});
1313
});

src/app/modules/logging-management/services/logging.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Service: LoggingService', () => {
99
}));
1010

1111
it('should be created', () => {
12-
const service: LoggingService = TestBed.get(LoggingService);
12+
const service: LoggingService = TestBed.inject(LoggingService);
1313
expect(service).toBeTruthy();
1414
});
1515
});

src/app/modules/security-management/security-management.module.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import {LdapConnectionTestDialogComponent} from './pages/ldap-management/securit
2323
MaterialModule,
2424
FormHelperModule,
2525
SecurityManagementRoutingModule
26-
],
27-
entryComponents: [LdapConnectionTestDialogComponent]
26+
]
2827
})
2928
export class SecurityManagementModule {
3029
}

src/app/modules/security-management/services/ldap-configuration.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('LdapConfigurationService', () => {
99
}));
1010

1111
it('should be created', () => {
12-
const service: LdapConfigurationService = TestBed.get(LdapConfigurationService);
12+
const service: LdapConfigurationService = TestBed.inject(LdapConfigurationService);
1313
expect(service).toBeTruthy();
1414
});
1515
});

src/app/modules/server-settings/guards/manage-settings.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ describe('Guard: ManageSettings should', () => {
4545
]
4646
}).compileComponents(); // compile template and css
4747

48-
guard = TestBed.get(ManageSettingsGuard);
49-
store = TestBed.get(Store);
48+
guard = TestBed.inject(ManageSettingsGuard);
49+
store = TestBed.inject(Store);
5050
});
5151

5252
it('allow logged in users with ADMIN authority to access route', () => {

src/app/modules/server-settings/services/server-settings.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('ServerSettingsService', () => {
1111
}));
1212

1313
it('should be created', () => {
14-
const service: ServerSettingsService = TestBed.get(ServerSettingsService);
14+
const service: ServerSettingsService = TestBed.inject(ServerSettingsService);
1515
expect(service).toBeTruthy();
1616
});
1717
});

src/app/modules/storage-management/pages/browse-repository/browse-repository.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ describe('Component: BrowseRepositoryComponent', () => {
3939
declarations: [BrowseRepositoryComponent]
4040
}).compileComponents();
4141

42-
router = TestBed.get(Router);
43-
ngZone = TestBed.get(NgZone);
42+
router = TestBed.inject(Router);
43+
ngZone = TestBed.inject(NgZone);
4444
ngZone.run(() => {
4545
router.initialNavigation();
4646
router.navigateByUrl('admin/storages/myStorageId/myRepositoryId/some/long/path');

src/app/modules/storage-management/services/storage-manager.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('Service: StorageManagerService', () => {
1616
}));
1717

1818
it('should be created', () => {
19-
const service: StorageManagerService = TestBed.get(StorageManagerService);
19+
const service: StorageManagerService = TestBed.inject(StorageManagerService);
2020
expect(service).toBeTruthy();
2121
});
2222
});

src/app/modules/storage-management/storage-management.module.ts

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ import {BrowseRepositoryComponent} from './pages/browse-repository/browse-reposi
3838
ManageRepositoryComponent,
3939
StorageFormDialogComponent,
4040
BrowseRepositoryComponent
41-
],
42-
entryComponents: [
43-
StorageFormDialogComponent
4441
]
4542
})
4643
export class StorageManagementModule {

src/app/modules/user-management/guards/create-user.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Guard: CreateUserGuard should', () => {
5353
]
5454
}).compileComponents(); // compile template and css
5555

56-
createUserGuard = TestBed.get(CreateUserGuard);
57-
store = TestBed.get(Store);
56+
createUserGuard = TestBed.inject(CreateUserGuard);
57+
store = TestBed.inject(Store);
5858
});
5959

6060
it('allow logged in users with CREATE_USER authority to access route', () => {

src/app/modules/user-management/guards/delete-user.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Guard: DeleteUserGuard should', () => {
5353
]
5454
}).compileComponents(); // compile template and css
5555

56-
deleteUserGuard = TestBed.get(DeleteUserGuard);
57-
store = TestBed.get(Store);
56+
deleteUserGuard = TestBed.inject(DeleteUserGuard);
57+
store = TestBed.inject(Store);
5858
});
5959

6060
it('allow logged in users with DELETE_USER authority to access route', () => {

src/app/modules/user-management/guards/update-user.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Guard: UpdateUserGuard should', () => {
5353
]
5454
}).compileComponents(); // compile template and css
5555

56-
updateUserGuard = TestBed.get(UpdateUserGuard);
57-
store = TestBed.get(Store);
56+
updateUserGuard = TestBed.inject(UpdateUserGuard);
57+
store = TestBed.inject(Store);
5858
});
5959

6060
it('allow logged in users with UPDATE_USER authority to access route', () => {

src/app/modules/user-management/guards/view-user.guard.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Guard: ViewUser should', () => {
5353
]
5454
}).compileComponents(); // compile template and css
5555

56-
viewUserGuard = TestBed.get(ViewUserGuard);
57-
store = TestBed.get(Store);
56+
viewUserGuard = TestBed.inject(ViewUserGuard);
57+
store = TestBed.inject(Store);
5858
});
5959

6060
it('allow logged in users with VIEW_USER authority to access route', () => {

src/app/shared/form/services/aql-autocomplete.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('AqlAutocompleteService', () => {
66
beforeEach(() => TestBed.configureTestingModule({}));
77

88
it('should be created', () => {
9-
const service: AqlAutocompleteService = TestBed.get(AqlAutocompleteService);
9+
const service: AqlAutocompleteService = TestBed.inject(AqlAutocompleteService);
1010
expect(service).toBeTruthy();
1111
});
1212
});

src/app/shared/form/services/form-data.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('FormDataServiceService', () => {
1111
}));
1212

1313
it('should be created', () => {
14-
const service: FormDataService = TestBed.get(FormDataService);
14+
const service: FormDataService = TestBed.inject(FormDataService);
1515
expect(service).toBeTruthy();
1616
});
1717
});

src/app/shared/layout/services/directory-listing.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Service: DirectoryListingService', () => {
99
}));
1010

1111
it('should be created', () => {
12-
const service: DirectoryListingService = TestBed.get(DirectoryListingService);
12+
const service: DirectoryListingService = TestBed.inject(DirectoryListingService);
1313
expect(service).toBeTruthy();
1414
});
1515
});

0 commit comments

Comments
 (0)