]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Remove date mock in CephFS directories spec
authorStephan Müller <smueller@suse.com>
Wed, 8 Jan 2020 17:05:05 +0000 (18:05 +0100)
committerStephan Müller <smueller@suse.com>
Mon, 17 Feb 2020 14:07:22 +0000 (15:07 +0100)
Fixes: https://tracker.ceph.com/issues/42617
Signed-off-by: Stephan Müller <smueller@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts

index 92d583b24f43089a08deb164bc3197b68b581025..894cfa08ba767a6040617f16c9a7bb34f4f162e2 100644 (file)
@@ -42,7 +42,6 @@ describe('CephfsDirectoriesComponent', () => {
   let maxValidator: jasmine.Spy;
   let minBinaryValidator: jasmine.Spy;
   let maxBinaryValidator: jasmine.Spy;
-  let originalDate: any;
   let modal: any;
 
   // Get's private attributes or functions
@@ -67,12 +66,11 @@ describe('CephfsDirectoriesComponent', () => {
     snapshots: (dirPath: string, howMany: number): CephfsSnapshot[] => {
       const name = 'someSnapshot';
       const snapshots = [];
+      const oneDay = 3600 * 24 * 1000;
       for (let i = 0; i < howMany; i++) {
         const snapName = `${name}${i + 1}`;
         const path = `${dirPath}/.snap/${snapName}`;
-        const created = new Date(
-          +new Date() - 3600 * 24 * 1000 * howMany * (howMany - i)
-        ).toString();
+        const created = new Date(+new Date() - oneDay * i).toString();
         snapshots.push({ name: snapName, path, created });
       }
       return snapshots;
@@ -147,7 +145,6 @@ describe('CephfsDirectoriesComponent', () => {
       modal = modalServiceShow(comp, init);
       return modal.ref;
     },
-    date: (arg: string) => (arg ? new originalDate(arg) : new Date('2022-02-22T00:00:00')),
     getControllerByPath: (path: string) => {
       return {
         expand: () => mockLib.expand(path),
@@ -357,8 +354,6 @@ describe('CephfsDirectoriesComponent', () => {
       deletedSnaps: [],
       updatedQuotas: {}
     };
-    originalDate = Date;
-    spyOn(global, 'Date').and.callFake(mockLib.date);
 
     cephfsService = TestBed.get(CephfsService);
     lsDirSpy = spyOn(cephfsService, 'lsDir').and.callFake(mockLib.lsDir);