]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
ca6e09f0cec7254bd9c384147f227bae0e4f4d7f
[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     fixture.detectChanges();
31   });
32
33   it('should create', () => {
34     expect(component).toBeTruthy();
35   });
36
37   it('should retrieve bucket full info', () => {
38     component.selection = { bid: 'bucket' };
39     component.ngOnChanges();
40     expect(rgwBucketServiceGetSpy).toHaveBeenCalled();
41   });
42 });