]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix unit tests cli warnings 21933/head
authorTiago Melo <tmelo@suse.com>
Thu, 10 May 2018 15:17:39 +0000 (16:17 +0100)
committerTiago Melo <tmelo@suse.com>
Thu, 10 May 2018 16:35:49 +0000 (17:35 +0100)
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.spec.ts

index d6ff1b54878ce5ae968be38f5784f7c5faaaf34a..fee8d2cfa6164adbe3fea63552003bf7f4f5b916 100644 (file)
@@ -1,14 +1,16 @@
+import { Component, Input } from '@angular/core';
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { RouterTestingModule } from '@angular/router/testing';
 
-import { BsDropdownModule } from 'ngx-bootstrap';
-
-import {
-  PerformanceCounterService
-} from '../../../shared/api/performance-counter.service';
-import { PerformanceCounterModule } from '../performance-counter.module';
+import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
 import { PerformanceCounterComponent } from './performance-counter.component';
 
+@Component({ selector: 'cd-table-performance-counter', template: '' })
+class TablePerformanceCounterStubComponent {
+  @Input() serviceType: string;
+  @Input() serviceId: string;
+}
+
 describe('PerformanceCounterComponent', () => {
   let component: PerformanceCounterComponent;
   let fixture: ComponentFixture<PerformanceCounterComponent>;
@@ -26,14 +28,13 @@ describe('PerformanceCounterComponent', () => {
     }
   };
 
-  beforeEach(
-    async(() => {
-      TestBed.configureTestingModule({
-        imports: [PerformanceCounterModule, BsDropdownModule.forRoot(), RouterTestingModule],
-        providers: [{ provide: PerformanceCounterService, useValue: fakeService }]
-      }).compileComponents();
-    })
-  );
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [PerformanceCounterComponent, TablePerformanceCounterStubComponent],
+      imports: [RouterTestingModule],
+      providers: [{ provide: PerformanceCounterService, useValue: fakeService }]
+    }).compileComponents();
+  }));
 
   beforeEach(() => {
     fixture = TestBed.createComponent(PerformanceCounterComponent);
index 6a219590074a212f5d3730fb45f07f185a72a63f..58d53ae4e1b052461da1acdcd84f02e79422d724 100644 (file)
@@ -1,27 +1,37 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { Component, Input } from '@angular/core';
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
-import { BsDropdownModule } from 'ngx-bootstrap';
+import { Observable } from 'rxjs/Observable';
 
-import { SharedModule } from '../../../shared/shared.module';
+import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
+import { CdTableColumn } from '../../../shared/models/cd-table-column';
+import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
+import { FormatterService } from '../../../shared/services/formatter.service';
 import { TablePerformanceCounterComponent } from './table-performance-counter.component';
 
+@Component({ selector: 'cd-table', template: '' })
+class TableStubComponent {
+  @Input() data: any[];
+  @Input() columns: CdTableColumn[];
+  @Input() autoReload: any = 5000;
+}
+
 describe('TablePerformanceCounterComponent', () => {
   let component: TablePerformanceCounterComponent;
   let fixture: ComponentFixture<TablePerformanceCounterComponent>;
 
+  const fakeService = {};
+
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ TablePerformanceCounterComponent ],
-      imports: [
-        HttpClientTestingModule,
-        HttpClientModule,
-        BsDropdownModule.forRoot(),
-        SharedModule
+      declarations: [TablePerformanceCounterComponent, TableStubComponent, DimlessPipe],
+      imports: [],
+      providers: [
+        { provide: PerformanceCounterService, useValue: fakeService },
+        DimlessPipe,
+        FormatterService
       ]
-    })
-    .compileComponents();
+    }).compileComponents();
   }));
 
   beforeEach(() => {
index 4df24b8d4b8faff117e897e2920a20924f187770..b06707ba311774ddb11270158bf62aec5700da9f 100644 (file)
@@ -1,16 +1,26 @@
-import { HttpClientModule } from '@angular/common/http';
+import { Component, Input } from '@angular/core';
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { RouterTestingModule } from '@angular/router/testing';
 
-import { BsDropdownModule } from 'ngx-bootstrap';
-import { TabsModule } from 'ngx-bootstrap/tabs';
+import { ModalModule } from 'ngx-bootstrap';
 
 import { RgwBucketService } from '../../../shared/api/rgw-bucket.service';
-import { DataTableModule } from '../../../shared/datatable/datatable.module';
-import { SharedModule } from '../../../shared/shared.module';
-import { RgwBucketDetailsComponent } from '../rgw-bucket-details/rgw-bucket-details.component';
+import { CdTableColumn } from '../../../shared/models/cd-table-column';
+import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { RgwBucketListComponent } from './rgw-bucket-list.component';
 
+@Component({ selector: 'cd-rgw-bucket-details', template: '' })
+class RgwBucketDetailsStubComponent {
+  @Input() selection: CdTableSelection;
+}
+
+@Component({ selector: 'cd-table', template: '' })
+class TableStubComponent {
+  @Input() data: any[];
+  @Input() columns: CdTableColumn[];
+  @Input() autoReload: any = 5000;
+}
+
 describe('RgwBucketListComponent', () => {
   let component: RgwBucketListComponent;
   let fixture: ComponentFixture<RgwBucketListComponent>;
@@ -25,21 +35,10 @@ describe('RgwBucketListComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [
-        RgwBucketListComponent,
-        RgwBucketDetailsComponent
-      ],
-      imports: [
-        HttpClientModule,
-        RouterTestingModule,
-        BsDropdownModule.forRoot(),
-        TabsModule.forRoot(),
-        DataTableModule,
-        SharedModule
-      ],
+      declarations: [RgwBucketListComponent, RgwBucketDetailsStubComponent, TableStubComponent],
+      imports: [RouterTestingModule, ModalModule.forRoot()],
       providers: [{ provide: RgwBucketService, useValue: fakeRgwBucketService }]
-    })
-    .compileComponents();
+    }).compileComponents();
   }));
 
   beforeEach(() => {