1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { ReactiveFormsModule } from '@angular/forms';
4 import { RouterTestingModule } from '@angular/router/testing';
6 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
7 import { ToastrModule } from 'ngx-toastr';
9 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
10 import { ComponentsModule } from '../../../shared/components/components.module';
11 import { PipesModule } from '../../../shared/pipes/pipes.module';
12 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
13 import { RbdSnapshotFormModalComponent } from './rbd-snapshot-form-modal.component';
15 describe('RbdSnapshotFormModalComponent', () => {
16 let component: RbdSnapshotFormModalComponent;
17 let fixture: ComponentFixture<RbdSnapshotFormModalComponent>;
24 HttpClientTestingModule,
25 ToastrModule.forRoot(),
28 declarations: [RbdSnapshotFormModalComponent],
29 providers: [NgbActiveModal, AuthStorageService, i18nProviders]
33 fixture = TestBed.createComponent(RbdSnapshotFormModalComponent);
34 component = fixture.componentInstance;
37 it('should create', () => {
38 expect(component).toBeTruthy();
41 it('should show "Create" text', () => {
42 fixture.detectChanges();
44 const header = fixture.debugElement.nativeElement.querySelector('h4');
45 expect(header.textContent).toBe('Create RBD Snapshot');
47 const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button');
48 expect(button.textContent).toBe('Create RBD Snapshot');
51 it('should show "Rename" text', () => {
52 component.setEditing();
54 fixture.detectChanges();
56 const header = fixture.debugElement.nativeElement.querySelector('h4');
57 expect(header.textContent).toBe('Rename RBD Snapshot');
59 const button = fixture.debugElement.nativeElement.querySelector('cd-submit-button');
60 expect(button.textContent).toBe('Rename RBD Snapshot');