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';
11 import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
13 describe('RgwBucketDetailsComponent', () => {
14 let component: RgwBucketDetailsComponent;
15 let fixture: ComponentFixture<RgwBucketDetailsComponent>;
16 let rgwBucketService: RgwBucketService;
17 let rgwBucketServiceGetSpy: jasmine.Spy;
20 declarations: [RgwBucketDetailsComponent],
21 imports: [SharedModule, HttpClientTestingModule, NgbNavModule]
25 rgwBucketService = TestBed.inject(RgwBucketService);
26 rgwBucketServiceGetSpy = spyOn(rgwBucketService, 'get');
27 rgwBucketServiceGetSpy.and.returnValue(of(null));
28 fixture = TestBed.createComponent(RgwBucketDetailsComponent);
29 component = fixture.componentInstance;
30 component.selection = new CdTableSelection();
31 component.selection = { bid: 'bucket', bucket_quota: { enabled: false, max_size: 0 } };
32 fixture.detectChanges();
35 it('should create', () => {
36 expect(component).toBeTruthy();
39 it('should retrieve bucket full info', () => {
40 component.selection = { bid: 'bucket' };
41 component.ngOnChanges();
42 expect(rgwBucketServiceGetSpy).toHaveBeenCalled();