]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cephfs / cephfs-tabs / cephfs-tabs.component.spec.ts
index 288863374673ca6ffcb94fe7d8592097d683418f..6a8a3991b108ea4dfa941a42be8a6d2db8b593c0 100644 (file)
@@ -2,16 +2,17 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { Component, Input } from '@angular/core';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 
-import { TreeModule } from 'angular-tree-component';
-import * as _ from 'lodash';
-import { TabsModule } from 'ngx-bootstrap/tabs';
+import { TreeModule } from '@circlon/angular-tree-component';
+import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
+import _ from 'lodash';
 import { ToastrModule } from 'ngx-toastr';
 import { of } from 'rxjs';
 
-import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
-import { CephfsService } from '../../../shared/api/cephfs.service';
-import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
-import { SharedModule } from '../../../shared/shared.module';
+import { CephfsService } from '~/app/shared/api/cephfs.service';
+import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
+import { ViewCacheStatus } from '~/app/shared/enum/view-cache-status.enum';
+import { SharedModule } from '~/app/shared/shared.module';
+import { configureTestBed } from '~/testing/unit-test-helper';
 import { CephfsClientsComponent } from '../cephfs-clients/cephfs-clients.component';
 import { CephfsDetailComponent } from '../cephfs-detail/cephfs-detail.component';
 import { CephfsDirectoriesComponent } from '../cephfs-directories/cephfs-directories.component';
@@ -35,7 +36,7 @@ describe('CephfsTabsComponent', () => {
   const setReload = (sth?: any) => (component['reloadSubscriber'] = sth);
   const mockRunOutside = () => {
     component['subscribeInterval'] = () => {
-      // It's mocked because the rxjs timer subscription ins't called through the use of 'tick'.
+      // It's mocked because the rxjs timer subscription isn't called through the use of 'tick'.
       setReload({
         unsubscribed: false,
         unsubscribe: () => {
@@ -80,7 +81,7 @@ describe('CephfsTabsComponent', () => {
   configureTestBed({
     imports: [
       SharedModule,
-      TabsModule.forRoot(),
+      NgbNavModule,
       HttpClientTestingModule,
       TreeModule,
       ToastrModule.forRoot()
@@ -91,8 +92,7 @@ describe('CephfsTabsComponent', () => {
       CephfsDetailComponent,
       CephfsDirectoriesComponent,
       CephfsClientsComponent
-    ],
-    providers: [i18nProviders]
+    ]
   });
 
   beforeEach(() => {
@@ -110,7 +110,7 @@ describe('CephfsTabsComponent', () => {
         data: [{}, {}, {}, {}]
       }
     };
-    service = TestBed.get(CephfsService);
+    service = TestBed.inject(CephfsService);
     spyOn(service, 'getTabs').and.callFake(() => of(data));
 
     fixture.detectChanges();
@@ -147,9 +147,9 @@ describe('CephfsTabsComponent', () => {
     };
     const defaultClients: Record<string, any> = {
       data: [],
-      status: ViewCacheStatus.ValueNone
+      status: new TableStatusViewCache(ViewCacheStatus.ValueNone)
     };
-    component['subscribeInterval'] = () => {};
+    component['subscribeInterval'] = () => undefined;
     updateData();
     expect(component.clients).not.toEqual(defaultClients);
     expect(component.details).not.toEqual(defaultDetails);