1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
4 import { of } from 'rxjs';
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';
12 describe('RgwBucketDetailsComponent', () => {
13 let component: RgwBucketDetailsComponent;
14 let fixture: ComponentFixture<RgwBucketDetailsComponent>;
15 let rgwBucketService: RgwBucketService;
16 let rgwBucketServiceGetSpy: jasmine.Spy;
19 declarations: [RgwBucketDetailsComponent],
20 imports: [SharedModule, HttpClientTestingModule]
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();
33 it('should create', () => {
34 expect(component).toBeTruthy();
37 it('should retrieve bucket full info', () => {
38 component.selection = { bid: 'bucket' };
39 component.ngOnChanges();
40 expect(rgwBucketServiceGetSpy).toHaveBeenCalled();