1 import { HttpClientTestingModule } from '@angular/common/http/testing';
2 import { ComponentFixture, TestBed } from '@angular/core/testing';
4 import { ToastrModule } from 'ngx-toastr';
10 } from '../../../../testing/unit-test-helper';
11 import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
12 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
13 import { SharedModule } from '../../../shared/shared.module';
14 import { CephfsClientsComponent } from './cephfs-clients.component';
16 describe('CephfsClientsComponent', () => {
17 let component: CephfsClientsComponent;
18 let fixture: ComponentFixture<CephfsClientsComponent>;
21 imports: [ToastrModule.forRoot(), SharedModule, HttpClientTestingModule],
22 declarations: [CephfsClientsComponent],
23 providers: i18nProviders
27 fixture = TestBed.createComponent(CephfsClientsComponent);
28 component = fixture.componentInstance;
30 status: ViewCacheStatus.ValueOk,
31 data: [{}, {}, {}, {}]
35 it('should create', () => {
36 fixture.detectChanges();
37 expect(component).toBeTruthy();
40 it('should test all TableActions combinations', () => {
41 const permissionHelper: PermissionHelper = new PermissionHelper(component.permission);
42 const tableActions: TableActionsComponent = permissionHelper.setPermissionsAndGetActions(
43 component.tableActions
46 expect(tableActions).toEqual({
47 'create,update,delete': {
49 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
53 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
57 primary: { multiple: '', executing: '', single: '', no: '' }
61 primary: { multiple: '', executing: '', single: '', no: '' }
65 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
69 primary: { multiple: 'Evict', executing: 'Evict', single: 'Evict', no: 'Evict' }
73 primary: { multiple: '', executing: '', single: '', no: '' }
77 primary: { multiple: '', executing: '', single: '', no: '' }