]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / rbd-trash-move-modal / rbd-trash-move-modal.component.spec.ts
index 1c77198e8d969698d3c5c7e2352e23b984069596..458e3852d9104116223ba556a5c881b88d06e506 100644 (file)
@@ -36,9 +36,10 @@ describe('RbdTrashMoveModalComponent', () => {
     component = fixture.componentInstance;
     httpTesting = TestBed.get(HttpTestingController);
 
-    component.metaType = 'RBD';
     component.poolName = 'foo';
     component.imageName = 'bar';
+
+    fixture.detectChanges();
   });
 
   it('should create', () => {
@@ -47,12 +48,11 @@ describe('RbdTrashMoveModalComponent', () => {
   });
 
   it('should finish running ngOnInit', () => {
-    fixture.detectChanges();
     expect(component.pattern).toEqual('foo/bar');
   });
 
   describe('should call moveImage', () => {
-    let notificationService;
+    let notificationService: NotificationService;
 
     beforeEach(() => {
       notificationService = TestBed.get(NotificationService);
@@ -67,7 +67,7 @@ describe('RbdTrashMoveModalComponent', () => {
 
     it('with normal delay', () => {
       component.moveImage();
-      const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
+      const req = httpTesting.expectOne('api/block/image/foo%2Fbar/move_trash');
       req.flush(null);
       expect(req.request.body).toEqual({ delay: 0 });
     });
@@ -79,7 +79,7 @@ describe('RbdTrashMoveModalComponent', () => {
       component.moveForm.patchValue({ expiresAt: oldDate });
 
       component.moveImage();
-      const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
+      const req = httpTesting.expectOne('api/block/image/foo%2Fbar/move_trash');
       req.flush(null);
       expect(req.request.body).toEqual({ delay: 0 });
     });
@@ -88,11 +88,10 @@ describe('RbdTrashMoveModalComponent', () => {
       const oldDate = moment()
         .add(24, 'hour')
         .toISOString();
-      fixture.detectChanges();
       component.moveForm.patchValue({ expiresAt: oldDate });
 
       component.moveImage();
-      const req = httpTesting.expectOne('api/block/image/foo/bar/move_trash');
+      const req = httpTesting.expectOne('api/block/image/foo%2Fbar/move_trash');
       req.flush(null);
       expect(req.request.body.delay).toBeGreaterThan(86390);
     });