]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Block the import of async from @angular/core/testing 36070/head
authorTiago Melo <tmelo@suse.com>
Mon, 13 Jul 2020 13:54:32 +0000 (13:54 +0000)
committerTiago Melo <tmelo@suse.com>
Thu, 16 Jul 2020 11:09:02 +0000 (11:09 +0000)
We no longer need this and it was causing unexpected results in some tests.

Fixes: https://tracker.ceph.com/issues/46500
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/app.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/layouts/blank-layout/blank-layout.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/layouts/login-layout/login-layout.component.spec.ts
src/pybind/mgr/dashboard/frontend/tslint.json

index b7a396a5d908a875964a48d91f9cef48a6f1463c..acf3a1219decf1f0630c3d62be897cdc4b6e44b3 100644 (file)
@@ -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 { AppComponent } from './app.component';
 
 describe('AppComponent', () => {
   let component: AppComponent;
   let fixture: ComponentFixture<AppComponent>;
 
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [AppComponent],
-      imports: [RouterTestingModule]
-    }).compileComponents();
-  }));
+  configureTestBed({
+    declarations: [AppComponent],
+    imports: [RouterTestingModule]
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(AppComponent);
index b4ba5643fb8089ebe0a6ddebf1eca88c6e412f2b..18e9fd5f1ef58162e588da92605ae34a737bf9f3 100644 (file)
@@ -1,5 +1,5 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
@@ -53,7 +53,7 @@ describe('HostsComponent', () => {
     expect(component).toBeTruthy();
   });
 
-  it('should render hosts list even with not permission mapped services', async(() => {
+  it('should render hosts list even with not permission mapped services', () => {
     const hostname = 'ceph.dev';
     const payload = [
       {
@@ -79,7 +79,7 @@ describe('HostsComponent', () => {
 
     hostListSpy.and.callFake(() => of(payload));
 
-    fixture.whenStable().then(() => {
+    return fixture.whenStable().then(() => {
       fixture.detectChanges();
 
       const spans = fixture.debugElement.nativeElement.querySelectorAll(
@@ -87,7 +87,7 @@ describe('HostsComponent', () => {
       );
       expect(spans[0].textContent).toBe(hostname);
     });
-  }));
+  });
 
   describe('getEditDisableDesc', () => {
     it('should return message (not managed by Orchestrator)', () => {
index ff3156d8a36e2b2d3a4dfc0c909e8a1fd46bffe2..2d136e799f9ba6fc41e9eea8ac6dccf504b78e18 100644 (file)
@@ -1,7 +1,7 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
 
-import { i18nProviders } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
 import { DeviceListComponent } from './device-list.component';
 
@@ -9,13 +9,11 @@ describe('DeviceListComponent', () => {
   let component: DeviceListComponent;
   let fixture: ComponentFixture<DeviceListComponent>;
 
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [DeviceListComponent],
-      imports: [SharedModule, HttpClientTestingModule],
-      providers: [i18nProviders]
-    }).compileComponents();
-  }));
+  configureTestBed({
+    declarations: [DeviceListComponent],
+    imports: [SharedModule, HttpClientTestingModule],
+    providers: [i18nProviders]
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(DeviceListComponent);
index 75c3686d488f8560db6d4d55e270b18b1d8350c3..2b836c7138d656165bdda34db14483657f078520 100644 (file)
@@ -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 { BlankLayoutComponent } from './blank-layout.component';
 
 describe('DefaultLayoutComponent', () => {
   let component: BlankLayoutComponent;
   let fixture: ComponentFixture<BlankLayoutComponent>;
 
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [BlankLayoutComponent],
-      imports: [RouterTestingModule]
-    }).compileComponents();
-  }));
+  configureTestBed({
+    declarations: [BlankLayoutComponent],
+    imports: [RouterTestingModule]
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(BlankLayoutComponent);
index 9299514e7c2ccbdbea5f82421a87b117a7b44641..575984aa0b27bcaa39fe1bbcce33119ae7752e7c 100644 (file)
@@ -1,8 +1,9 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 import { RouterTestingModule } from '@angular/router/testing';
 
+import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
 import { LoginLayoutComponent } from './login-layout.component';
 
@@ -10,12 +11,10 @@ describe('LoginLayoutComponent', () => {
   let component: LoginLayoutComponent;
   let fixture: ComponentFixture<LoginLayoutComponent>;
 
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [LoginLayoutComponent],
-      imports: [BrowserAnimationsModule, HttpClientTestingModule, RouterTestingModule, SharedModule]
-    }).compileComponents();
-  }));
+  configureTestBed({
+    declarations: [LoginLayoutComponent],
+    imports: [BrowserAnimationsModule, HttpClientTestingModule, RouterTestingModule, SharedModule]
+  });
 
   beforeEach(() => {
     fixture = TestBed.createComponent(LoginLayoutComponent);
index 5136dc651af55a31c909368c86b83414ea97c504..ff81249e78eeef19af5a3bbd52394c1076951e35 100644 (file)
@@ -12,7 +12,7 @@
     },
     "eofline": true,
     "forin": true,
-    "import-blacklist": [true, "rxjs/Rx"],
+    "import-blacklist": [true, "rxjs/Rx", {"@angular/core/testing": ["async"]}],
     "import-spacing": true,
     "indent": [true, "spaces"],
     "interface-over-type-literal": true,