Skip to content

Commit

Permalink
[ACS-5645] removed unused unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
AnukritiGL committed Dec 12, 2023
1 parent 2c9e4c9 commit 8dc4f89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,60 +198,6 @@ describe('MetadataTabComponent', () => {
});
});

describe('editable', () => {
let editOfflineAction: EditOfflineAction;

beforeEach(() => {
fixture = TestBed.createComponent(MetadataTabComponent);
component = fixture.componentInstance;
component.node = {
id: 'some id',
allowableOperations: []
} as Node;
component.ngOnInit();
editOfflineAction = new EditOfflineAction({
entry: {
isLocked: false,
allowableOperations: ['update'],
id: component.node.id
} as Node
});
component.editable = true;
});

it('should not have set false if node is not locked and has update permission', () => {
actions$.next(editOfflineAction);
expect(component.editable).toBeTrue();
});

it('should not have set false if changed node has different id than original', () => {
editOfflineAction.payload.entry.id = 'some other id';
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.editable).toBeTrue();
});

it('should have set false if node is locked', () => {
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});

it('should have set false if node has no update permission', () => {
editOfflineAction.payload.entry.allowableOperations = ['other'];
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});

it('should have set false if node has read only property', () => {
editOfflineAction.payload.entry.properties = {
'cm:lockType': 'WRITE_LOCK'
};
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});
});

describe('ContentMetadataCardComponent', () => {
const getContentMetadataCard = (): ContentMetadataCardComponent =>
fixture.debugElement.query(By.directive(ContentMetadataCardComponent)).componentInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import {
ContentMetadataModule,
ContentMetadataService,
ContentMetadataCustomPanel,
TagService,
CategoryService
} from '@alfresco/adf-content-services';
import { ContentMetadataModule, ContentMetadataService, ContentMetadataCustomPanel } from '@alfresco/adf-content-services';
import { filter, map, takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { Actions, ofType } from '@ngrx/effects';
Expand All @@ -51,11 +45,6 @@ import { Actions, ofType } from '@ngrx/effects';
[node]="node"
[displayAspect]="displayAspect$ | async"
[customPanels]="customPanels | async"
[displayTags]="true"
[displayCategories]="true"
[(editable)]="editable"
[displayCategories]="displayCategories"
[displayTags]="displayTags"
>
</adf-content-metadata>
`,
Expand All @@ -64,34 +53,21 @@ import { Actions, ofType } from '@ngrx/effects';
})
export class MetadataTabComponent implements OnInit, OnDestroy {
protected onDestroy$ = new Subject<boolean>();
private _displayCategories = true;
private _displayTags = true;

@Input()
node: Node;

displayAspect$: Observable<string>;
readOnly = false;
customPanels: Observable<ContentMetadataCustomPanel[]>;

get displayCategories(): boolean {
return this._displayCategories;
}

get displayTags(): boolean {
return this._displayTags;
}

constructor(
private permission: NodePermissionService,
protected extensions: AppExtensionService,
private appConfig: AppConfigService,
private store: Store<AppStore>,
private notificationService: NotificationService,
private contentMetadataService: ContentMetadataService,
private actions$: Actions,
private tagService: TagService,
private categoryService: CategoryService
private actions$: Actions
) {
if (this.extensions.contentMetadata) {
this.appConfig.config['content-metadata'].presets = this.extensions.contentMetadata.presets;
Expand All @@ -100,8 +76,6 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
}

ngOnInit() {
this._displayTags = this.tagService.areTagsEnabled();
this._displayCategories = this.categoryService.areCategoriesEnabled();
this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => {
this.notificationService.showError(err.message);
});
Expand Down

0 comments on commit 8dc4f89

Please sign in to comment.