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