]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / rbd-trash-restore-modal / rbd-trash-restore-modal.component.spec.ts
index 79d800279b4da55259a62c9fb60ce7c1dbd819ca..7eb963a6ef03410af78a5c51ee1439b38372f324 100644 (file)
@@ -7,12 +7,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
 import { RouterTestingModule } from '@angular/router/testing';
 
-import { BsModalRef } from 'ngx-bootstrap/modal';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 import { ToastrModule } from 'ngx-toastr';
 
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
-import { NotificationService } from '../../../shared/services/notification.service';
-import { SharedModule } from '../../../shared/shared.module';
+import { NotificationService } from '~/app/shared/services/notification.service';
+import { SharedModule } from '~/app/shared/shared.module';
+import { configureTestBed } from '~/testing/unit-test-helper';
 import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal.component';
 
 describe('RbdTrashRestoreModalComponent', () => {
@@ -28,7 +28,7 @@ describe('RbdTrashRestoreModalComponent', () => {
       SharedModule,
       RouterTestingModule
     ],
-    providers: [BsModalRef, i18nProviders]
+    providers: [NgbActiveModal]
   });
 
   beforeEach(() => {
@@ -44,20 +44,20 @@ describe('RbdTrashRestoreModalComponent', () => {
   describe('should call restore', () => {
     let httpTesting: HttpTestingController;
     let notificationService: NotificationService;
-    let modalRef: BsModalRef;
+    let activeModal: NgbActiveModal;
     let req: TestRequest;
 
     beforeEach(() => {
-      httpTesting = TestBed.get(HttpTestingController);
-      notificationService = TestBed.get(NotificationService);
-      modalRef = TestBed.get(BsModalRef);
+      httpTesting = TestBed.inject(HttpTestingController);
+      notificationService = TestBed.inject(NotificationService);
+      activeModal = TestBed.inject(NgbActiveModal);
 
       component.poolName = 'foo';
       component.imageName = 'bar';
       component.imageId = '113cb6963793';
       component.ngOnInit();
 
-      spyOn(modalRef, 'hide').and.stub();
+      spyOn(activeModal, 'close').and.stub();
       spyOn(component.restoreForm, 'setErrors').and.stub();
       spyOn(notificationService, 'show').and.stub();
 
@@ -69,13 +69,13 @@ describe('RbdTrashRestoreModalComponent', () => {
     it('with success', () => {
       req.flush(null);
       expect(component.restoreForm.setErrors).toHaveBeenCalledTimes(0);
-      expect(component.modalRef.hide).toHaveBeenCalledTimes(1);
+      expect(component.activeModal.close).toHaveBeenCalledTimes(1);
     });
 
     it('with failure', () => {
       req.flush(null, { status: 500, statusText: 'failure' });
       expect(component.restoreForm.setErrors).toHaveBeenCalledTimes(1);
-      expect(component.modalRef.hide).toHaveBeenCalledTimes(0);
+      expect(component.activeModal.close).toHaveBeenCalledTimes(0);
     });
   });
 });