]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
8b9f4bbe64228b8562e85f39563d1d52ba14d2b7
[ceph-ci.git] /
1 import { ComponentFixture, TestBed } from '@angular/core/testing';
2
3 import { RgwStorageClassDetailsComponent } from './rgw-storage-class-details.component';
4 import { StorageClassDetails } from '../models/rgw-storage-class.model';
5 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
6 import { SharedModule } from '~/app/shared/shared.module';
7 import { HttpClientTestingModule } from '@angular/common/http/testing';
8 import { RouterTestingModule } from '@angular/router/testing';
9
10 describe('RgwStorageClassDetailsComponent', () => {
11   let component: RgwStorageClassDetailsComponent;
12   let fixture: ComponentFixture<RgwStorageClassDetailsComponent>;
13
14   beforeEach(async () => {
15     await TestBed.configureTestingModule({
16       imports: [
17         BrowserAnimationsModule,
18         SharedModule,
19         HttpClientTestingModule,
20         RouterTestingModule
21       ],
22       declarations: [RgwStorageClassDetailsComponent]
23     }).compileComponents();
24
25     fixture = TestBed.createComponent(RgwStorageClassDetailsComponent);
26     component = fixture.componentInstance;
27     fixture.detectChanges();
28   });
29
30   it('should create', () => {
31     expect(component).toBeTruthy();
32   });
33
34   it('should update storageDetails when selection input changes', () => {
35     const mockSelection: StorageClassDetails = {
36       access_key: 'TestAccessKey',
37       secret: 'TestSecret',
38       target_path: '/test/path',
39       multipart_min_part_size: 100,
40       multipart_sync_threshold: 200,
41       host_style: 'path',
42       retain_head_object: true,
43       allow_read_through: true
44     };
45     component.selection = mockSelection;
46     component.ngOnChanges();
47     expect(component.storageDetails).toEqual(mockSelection);
48   });
49 });