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