1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { FormControl, ReactiveFormsModule } from '@angular/forms';
4 import { RouterTestingModule } from '@angular/router/testing';
6 import { BsModalRef } from 'ngx-bootstrap/modal';
8 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
9 import { SharedModule } from '../../../shared/shared.module';
10 import { IscsiTargetIqnSettingsModalComponent } from './iscsi-target-iqn-settings-modal.component';
12 describe('IscsiTargetIqnSettingsModalComponent', () => {
13 let component: IscsiTargetIqnSettingsModalComponent;
14 let fixture: ComponentFixture<IscsiTargetIqnSettingsModalComponent>;
17 declarations: [IscsiTargetIqnSettingsModalComponent],
18 imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule],
19 providers: [BsModalRef, i18nProviders]
23 fixture = TestBed.createComponent(IscsiTargetIqnSettingsModalComponent);
24 component = fixture.componentInstance;
25 component.target_controls = new FormControl({});
26 component.target_default_controls = {
29 first_burst_length: 'Yes'
32 fixture.detectChanges();
35 it('should create', () => {
36 expect(component).toBeTruthy();
39 it('should fill the settingsForm', () => {
40 expect(component.settingsForm.value).toEqual({
42 dataout_timeout: null,
43 first_burst_length: null
47 it('should save changes to target_controls', () => {
48 component.settingsForm.patchValue({ dataout_timeout: 1234 });
49 expect(component.target_controls.value).toEqual({});
51 expect(component.target_controls.value).toEqual({ dataout_timeout: 1234 });