mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
97049: Nest before each statements
This commit is contained in:
@@ -87,10 +87,6 @@ describe('SearchHierarchyFilterComponent', () => {
|
|||||||
showVocabularyTreeLink = fixture.debugElement.query(By.css('a#show-test-search-filter-tree'));
|
showVocabularyTreeLink = fixture.debugElement.query(By.css('a#show-test-search-filter-tree'));
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
fixture.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('if the vocabulary doesn\'t exist', () => {
|
describe('if the vocabulary doesn\'t exist', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -100,9 +96,8 @@ describe('SearchHierarchyFilterComponent', () => {
|
|||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not show the vocabulary tree link', (done) => {
|
it('should not show the vocabulary tree link', () => {
|
||||||
expect(showVocabularyTreeLink).toBeNull();
|
expect(showVocabularyTreeLink).toBeNull();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,39 +110,34 @@ describe('SearchHierarchyFilterComponent', () => {
|
|||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the vocabulary tree link', (done) => {
|
it('should show the vocabulary tree link', () => {
|
||||||
expect(showVocabularyTreeLink).toBeTruthy();
|
expect(showVocabularyTreeLink).toBeTruthy();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when clicking the vocabulary tree link', () => {
|
describe('when clicking the vocabulary tree link', () => {
|
||||||
|
|
||||||
|
const alreadySelectedValues = [
|
||||||
|
'already-selected-value-1',
|
||||||
|
'already-selected-value-2',
|
||||||
|
];
|
||||||
|
const newSelectedValue = 'new-selected-value';
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
showVocabularyTreeLink.nativeElement.click();
|
showVocabularyTreeLink.nativeElement.click();
|
||||||
|
fixture.componentInstance.selectedValues$ = observableOf(
|
||||||
|
alreadySelectedValues.map(value => Object.assign(new FacetValue(), { value }))
|
||||||
|
);
|
||||||
|
VocabularyTreeViewComponent.select.emit(Object.assign(new VocabularyEntryDetail(), {
|
||||||
|
value: newSelectedValue,
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the vocabulary tree modal', (done) => {
|
it('should open the vocabulary tree modal', () => {
|
||||||
expect(ngbModal.open).toHaveBeenCalled();
|
expect(ngbModal.open).toHaveBeenCalled();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when selecting a value from the vocabulary tree', () => {
|
describe('when selecting a value from the vocabulary tree', () => {
|
||||||
|
|
||||||
const alreadySelectedValues = [
|
|
||||||
'already-selected-value-1',
|
|
||||||
'already-selected-value-2',
|
|
||||||
];
|
|
||||||
const newSelectedValue = 'new-selected-value';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture.componentInstance.selectedValues$ = observableOf(
|
|
||||||
alreadySelectedValues.map(value => Object.assign(new FacetValue(), { value }))
|
|
||||||
);
|
|
||||||
VocabularyTreeViewComponent.select.emit(Object.assign(new VocabularyEntryDetail(), {
|
|
||||||
value: newSelectedValue,
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should add a new search filter to the existing search filters', () => {
|
it('should add a new search filter to the existing search filters', () => {
|
||||||
waitForAsync(() => expect(router.navigate).toHaveBeenCalledWith([testSearchLink], {
|
waitForAsync(() => expect(router.navigate).toHaveBeenCalledWith([testSearchLink], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
Reference in New Issue
Block a user