[AAE-10320] Fix Content Service unit tests - 'has no expectations' (#7840)

* fix node action services unit tests

* fix add permission panel units

* fix some upload unit tests

* fix some search unit tests

* remove duplicated unit tests

* [AAE-10320] fix content and document list unit tests

* remove duplicated content node selector  unit test

* fix upload unit test
This commit is contained in:
Tomasz Gnyp
2022-09-30 22:16:07 +02:00
committed by GitHub
parent 4d8195fa82
commit 39a178f653
14 changed files with 275 additions and 387 deletions

View File

@@ -468,32 +468,6 @@ describe('ContentNodeSelectorPanelComponent', () => {
component.isSelectionValid = returnHasPermission;
});
it('should NOT be null after selecting node with the necessary permissions', async () => {
hasAllowableOperations = true;
component.documentList.folderNode = entry;
component.select.subscribe((nodes) => {
expect(nodes).toBeDefined();
expect(nodes).not.toBeNull();
expect(component.chosenNode[0]).toBe(entry);
});
component.documentList.ready.emit(nodePage);
});
it('should be null after selecting node without the necessary permissions', async () => {
hasAllowableOperations = false;
component.documentList.folderNode = entry;
component.select.subscribe((nodes) => {
expect(nodes).toBeDefined();
expect(nodes).toBeNull();
expect(component.chosenNode).toBeNull();
});
component.documentList.ready.emit(nodePage);
});
it('should NOT be null after clicking on a node (with the right permissions) in the list (onNodeSelect)', async () => {
hasAllowableOperations = true;

View File

@@ -177,43 +177,19 @@ describe('ContentNodeSelectorComponent', () => {
});
describe('Cancel button', () => {
it('should complete the data stream when user click "CANCEL"', () => {
let cancelButton;
data.select.subscribe(
() => {
},
() => {
},
() => {
cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
expect(cancelButton).not.toBeNull();
});
cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
cancelButton.triggerEventHandler('click', {});
});
it('should not be shown if dialogRef is NOT injected', () => {
const closeButton = fixture.debugElement.query(By.css('[content-node-selector-actions-cancel]'));
expect(closeButton).toBeNull();
});
it('should close the dialog', () => {
let cancelButton;
data.select.subscribe(
() => {
},
() => {
},
() => {
cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
expect(cancelButton).not.toBeNull();
});
cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
let cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
cancelButton.triggerEventHandler('click', {});
expect(dialog.close).toHaveBeenCalled();
fixture.detectChanges();
cancelButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-actions-cancel"]'));
expect(cancelButton).not.toBeNull();
});
});