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';
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: () => {
configureTestBed({
imports: [
SharedModule,
- TabsModule.forRoot(),
+ NgbNavModule,
HttpClientTestingModule,
TreeModule,
ToastrModule.forRoot()
CephfsDetailComponent,
CephfsDirectoriesComponent,
CephfsClientsComponent
- ],
- providers: [i18nProviders]
+ ]
});
beforeEach(() => {
data: [{}, {}, {}, {}]
}
};
- service = TestBed.get(CephfsService);
+ service = TestBed.inject(CephfsService);
spyOn(service, 'getTabs').and.callFake(() => of(data));
fixture.detectChanges();
};
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);