]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
59f62952a5075b8dcc46a09d06ef4bc5cde54784
[ceph.git] /
1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3
4 import { of } from 'rxjs';
5
6 import { RgwBucketService } from '~/app/shared/api/rgw-bucket.service';
7 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
8 import { SharedModule } from '~/app/shared/shared.module';
9 import { configureTestBed } from '~/testing/unit-test-helper';
10 import { RgwBucketDetailsComponent } from './rgw-bucket-details.component';
11
12 describe('RgwBucketDetailsComponent', () => {
13   let component: RgwBucketDetailsComponent;
14   let fixture: ComponentFixture<RgwBucketDetailsComponent>;
15   let rgwBucketService: RgwBucketService;
16   let rgwBucketServiceGetSpy: jasmine.Spy;
17
18   configureTestBed({
19     declarations: [RgwBucketDetailsComponent],
20     imports: [SharedModule, HttpClientTestingModule]
21   });
22
23   beforeEach(() => {
24     rgwBucketService = TestBed.inject(RgwBucketService);
25     rgwBucketServiceGetSpy = spyOn(rgwBucketService, 'get');
26     rgwBucketServiceGetSpy.and.returnValue(of(null));
27     fixture = TestBed.createComponent(RgwBucketDetailsComponent);
28     component = fixture.componentInstance;
29     component.selection = new CdTableSelection();
30     component.selection = { bid: 'bucket', bucket_quota: { enabled: false, max_size: 0 } };
31     fixture.detectChanges();
32   });
33
34   it('should create', () => {
35     expect(component).toBeTruthy();
36   });
37
38   it('should retrieve bucket full info', () => {
39     component.selection = { bid: 'bucket' };
40     component.ngOnChanges();
41     expect(rgwBucketServiceGetSpy).toHaveBeenCalled();
42   });
43 });