1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
5 import { ToastrModule } from 'ngx-toastr';
11 } from '../../../../testing/unit-test-helper';
12 import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
13 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
14 import { SharedModule } from '../../../shared/shared.module';
15 import { CephfsClientsComponent } from './cephfs-clients.component';
17 describe('CephfsClientsComponent', () => {
18 let component: CephfsClientsComponent;
19 let fixture: ComponentFixture<CephfsClientsComponent>;
23 BrowserAnimationsModule,
24 ToastrModule.forRoot(),
26 HttpClientTestingModule
28 declarations: [CephfsClientsComponent],
29 providers: i18nProviders
33 fixture = TestBed.createComponent(CephfsClientsComponent);
34 component = fixture.componentInstance;
36 status: ViewCacheStatus.ValueOk,
37 data: [{}, {}, {}, {}]
41 it('should create', () => {
42 fixture.detectChanges();
43 expect(component).toBeTruthy();
46 it('should test all TableActions combinations', () => {
47 const permissionHelper: PermissionHelper = new PermissionHelper(component.permission);
48 const tableActions: TableActionsComponent = permissionHelper.setPermissionsAndGetActions(
49 component.tableActions
52 expect(tableActions).toEqual({
53 'create,update,delete': {
55 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
59 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
63 primary: { multiple: '', executing: '', single: '', no: '' }
67 primary: { multiple: '', executing: '', single: '', no: '' }
71 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
75 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
79 primary: { multiple: '', executing: '', single: '', no: '' }
83 primary: { multiple: '', executing: '', single: '', no: '' }