]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
b06707ba311774ddb11270158bf62aec5700da9f
[ceph.git] /
1 import { Component, Input } from '@angular/core';
2 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3 import { RouterTestingModule } from '@angular/router/testing';
4
5 import { ModalModule } from 'ngx-bootstrap';
6
7 import { RgwBucketService } from '../../../shared/api/rgw-bucket.service';
8 import { CdTableColumn } from '../../../shared/models/cd-table-column';
9 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
10 import { RgwBucketListComponent } from './rgw-bucket-list.component';
11
12 @Component({ selector: 'cd-rgw-bucket-details', template: '' })
13 class RgwBucketDetailsStubComponent {
14   @Input() selection: CdTableSelection;
15 }
16
17 @Component({ selector: 'cd-table', template: '' })
18 class TableStubComponent {
19   @Input() data: any[];
20   @Input() columns: CdTableColumn[];
21   @Input() autoReload: any = 5000;
22 }
23
24 describe('RgwBucketListComponent', () => {
25   let component: RgwBucketListComponent;
26   let fixture: ComponentFixture<RgwBucketListComponent>;
27
28   const fakeRgwBucketService = {
29     list: () => {
30       return new Promise(function(resolve) {
31         resolve([]);
32       });
33     }
34   };
35
36   beforeEach(async(() => {
37     TestBed.configureTestingModule({
38       declarations: [RgwBucketListComponent, RgwBucketDetailsStubComponent, TableStubComponent],
39       imports: [RouterTestingModule, ModalModule.forRoot()],
40       providers: [{ provide: RgwBucketService, useValue: fakeRgwBucketService }]
41     }).compileComponents();
42   }));
43
44   beforeEach(() => {
45     fixture = TestBed.createComponent(RgwBucketListComponent);
46     component = fixture.componentInstance;
47     fixture.detectChanges();
48   });
49
50   it('should create', () => {
51     expect(component).toBeTruthy();
52   });
53 });