]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
0156b9196e19e03ce467598052994e3b988007c9
[ceph-ci.git] /
1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { FormsModule } from '@angular/forms';
4 import { By } from '@angular/platform-browser';
5 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
6 import { RouterTestingModule } from '@angular/router/testing';
7
8 import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
9
10 import { SharedModule } from '~/app/shared/shared.module';
11 import { configureTestBed } from '~/testing/unit-test-helper';
12 import { ConfigurationDetailsComponent } from './configuration-details/configuration-details.component';
13 import { ConfigurationComponent } from './configuration.component';
14 import { TableComponent } from '~/app/shared/datatable/table/table.component';
15
16 describe('ConfigurationComponent', () => {
17   let component: ConfigurationComponent;
18   let fixture: ComponentFixture<ConfigurationComponent>;
19
20   configureTestBed({
21     declarations: [ConfigurationComponent, ConfigurationDetailsComponent, TableComponent],
22     imports: [
23       BrowserAnimationsModule,
24       SharedModule,
25       FormsModule,
26       NgbNavModule,
27       HttpClientTestingModule,
28       RouterTestingModule
29     ]
30   });
31
32   beforeEach(() => {
33     fixture = TestBed.createComponent(ConfigurationComponent);
34     component = fixture.componentInstance;
35     fixture.detectChanges();
36   });
37
38   it('should create', () => {
39     expect(component).toBeTruthy();
40   });
41
42   it('should check header text', () => {
43     const cdTableEl = fixture.debugElement.query(By.directive(TableComponent));
44     const cdTableComponent: TableComponent = cdTableEl.componentInstance;
45     cdTableComponent.ngAfterViewInit();
46     fixture.detectChanges();
47     const actual = fixture.debugElement.query(By.css('thead')).nativeElement.textContent.trim();
48     const expected = 'Name  Description  Current value  Default  Editable';
49     expect(actual).toBe(expected);
50   });
51 });