From: Tiago Melo Date: Fri, 12 Oct 2018 17:22:49 +0000 (+0100) Subject: mgr/dashboard: Use configureTestBed in remaining tests X-Git-Tag: v14.1.0~1130^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=650f7f65ee4fefbf152c662f2b50aff8332a3983;p=ceph.git mgr/dashboard: Use configureTestBed in remaining tests Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-images/rbd-images.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-images/rbd-images.component.spec.ts index 82cc3f7efbf..03c51f10288 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-images/rbd-images.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-images/rbd-images.component.spec.ts @@ -1,10 +1,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ToastModule } from 'ng2-toastr'; import { TabsModule, TooltipModule } from 'ngx-bootstrap'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { TaskListService } from '../../../shared/services/task-list.service'; import { SharedModule } from '../../../shared/shared.module'; import { RbdDetailsComponent } from '../rbd-details/rbd-details.component'; @@ -17,26 +18,24 @@ describe('RbdImagesComponent', () => { let component: RbdImagesComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - RbdDetailsComponent, - RbdImagesComponent, - RbdListComponent, - RbdSnapshotListComponent, - RbdTrashListComponent - ], - imports: [ - HttpClientTestingModule, - RouterTestingModule, - SharedModule, - TabsModule.forRoot(), - ToastModule.forRoot(), - TooltipModule.forRoot() - ], - providers: [TaskListService] - }).compileComponents(); - })); + configureTestBed({ + declarations: [ + RbdDetailsComponent, + RbdImagesComponent, + RbdListComponent, + RbdSnapshotListComponent, + RbdTrashListComponent + ], + imports: [ + HttpClientTestingModule, + RouterTestingModule, + SharedModule, + TabsModule.forRoot(), + ToastModule.forRoot(), + TooltipModule.forRoot() + ], + providers: [TaskListService] + }); beforeEach(() => { fixture = TestBed.createComponent(RbdImagesComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.spec.ts index f5492508d1d..b7082b3a57e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.spec.ts @@ -1,18 +1,17 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { InfoCardComponent } from './info-card.component'; describe('InfoCardComponent', () => { let component: InfoCardComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [RouterTestingModule], - declarations: [InfoCardComponent] - }).compileComponents(); - })); + configureTestBed({ + imports: [RouterTestingModule], + declarations: [InfoCardComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(InfoCardComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-group/info-group.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-group/info-group.component.spec.ts index 0bb0abb5c45..c0f476b7bb4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-group/info-group.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-group/info-group.component.spec.ts @@ -1,16 +1,15 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { InfoGroupComponent } from './info-group.component'; describe('InfoGroupComponent', () => { let component: InfoGroupComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [InfoGroupComponent] - }).compileComponents(); - })); + configureTestBed({ + declarations: [InfoGroupComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(InfoGroupComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts index 3d34a3af5b2..b215392e3f1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.spec.ts @@ -1,10 +1,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ToastModule } from 'ng2-toastr'; import { TabsModule } from 'ngx-bootstrap'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { SharedModule } from '../../../shared/shared.module'; import { RoleDetailsComponent } from './role-details.component'; @@ -13,18 +14,16 @@ describe('RoleDetailsComponent', () => { let component: RoleDetailsComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - SharedModule, - ToastModule.forRoot(), - TabsModule.forRoot(), - RouterTestingModule, - HttpClientTestingModule - ], - declarations: [RoleDetailsComponent] - }).compileComponents(); - })); + configureTestBed({ + imports: [ + SharedModule, + ToastModule.forRoot(), + TabsModule.forRoot(), + RouterTestingModule, + HttpClientTestingModule + ], + declarations: [RoleDetailsComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(RoleDetailsComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts index 50767dd41da..b58a6e979f9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.spec.ts @@ -1,12 +1,12 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { ToastModule } from 'ng2-toastr'; import { TabsModule } from 'ngx-bootstrap'; -import { PermissionHelper } from '../../../../testing/unit-test-helper'; +import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper'; import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component'; import { SharedModule } from '../../../shared/shared.module'; import { UserTabsComponent } from '../user-tabs/user-tabs.component'; @@ -16,18 +16,16 @@ describe('UserListComponent', () => { let component: UserListComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - SharedModule, - ToastModule.forRoot(), - TabsModule.forRoot(), - RouterTestingModule, - HttpClientTestingModule - ], - declarations: [UserListComponent, UserTabsComponent] - }).compileComponents(); - })); + configureTestBed({ + imports: [ + SharedModule, + ToastModule.forRoot(), + TabsModule.forRoot(), + RouterTestingModule, + HttpClientTestingModule + ], + declarations: [UserListComponent, UserTabsComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(UserListComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.spec.ts index 475df8c4d47..e5b14636586 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.spec.ts @@ -1,10 +1,11 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { ToastModule } from 'ng2-toastr'; import { TabsModule } from 'ngx-bootstrap'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { UserTabsComponent } from './user-tabs.component'; @@ -12,18 +13,16 @@ describe('UserTabsComponent', () => { let component: UserTabsComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - SharedModule, - ToastModule.forRoot(), - TabsModule.forRoot(), - RouterTestingModule, - HttpClientTestingModule - ], - declarations: [UserTabsComponent] - }).compileComponents(); - })); + configureTestBed({ + imports: [ + SharedModule, + ToastModule.forRoot(), + TabsModule.forRoot(), + RouterTestingModule, + HttpClientTestingModule + ], + declarations: [UserTabsComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(UserTabsComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.spec.ts index 1358406525a..3ed7d32d21d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.spec.ts @@ -1,16 +1,15 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { configureTestBed } from '../../../testing/unit-test-helper'; import { ForbiddenComponent } from './forbidden.component'; describe('ForbiddenComponent', () => { let component: ForbiddenComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ForbiddenComponent] - }).compileComponents(); - })); + configureTestBed({ + declarations: [ForbiddenComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(ForbiddenComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.spec.ts index a4c47b4f7ea..ae695068d90 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/administration/administration.component.spec.ts @@ -1,5 +1,6 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { SharedModule } from '../../../shared/shared.module'; import { AdministrationComponent } from './administration.component'; @@ -7,12 +8,10 @@ describe('AdministrationComponent', () => { let component: AdministrationComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [SharedModule], - declarations: [AdministrationComponent] - }).compileComponents(); - })); + configureTestBed({ + imports: [SharedModule], + declarations: [AdministrationComponent] + }); beforeEach(() => { fixture = TestBed.createComponent(AdministrationComponent); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts index cb0ea160d4c..7058200775d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts @@ -1,8 +1,9 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ReactiveFormsModule } from '@angular/forms'; import { BsModalRef } from 'ngx-bootstrap'; +import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ModalComponent } from '../modal/modal.component'; import { SubmitButtonComponent } from '../submit-button/submit-button.component'; import { ConfirmationModalComponent } from './confirmation-modal.component'; @@ -11,13 +12,11 @@ describe('ConfirmationModalComponent', () => { let component: ConfirmationModalComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ConfirmationModalComponent, SubmitButtonComponent, ModalComponent], - imports: [ReactiveFormsModule], - providers: [BsModalRef] - }).compileComponents(); - })); + configureTestBed({ + declarations: [ConfirmationModalComponent, SubmitButtonComponent, ModalComponent], + imports: [ReactiveFormsModule], + providers: [BsModalRef] + }); beforeEach(() => { fixture = TestBed.createComponent(ConfirmationModalComponent);