97049: Nest before each statements

This commit is contained in:
Jens Vannerum
2023-01-02 14:38:20 +01:00
parent 6012c66d1c
commit 3e09653f0b

View File

@@ -87,10 +87,6 @@ describe('SearchHierarchyFilterComponent', () => {
showVocabularyTreeLink = fixture.debugElement.query(By.css('a#show-test-search-filter-tree'));
}
afterEach(() => {
fixture.destroy();
});
describe('if the vocabulary doesn\'t exist', () => {
beforeEach(() => {
@@ -100,9 +96,8 @@ describe('SearchHierarchyFilterComponent', () => {
init();
});
it('should not show the vocabulary tree link', (done) => {
it('should not show the vocabulary tree link', () => {
expect(showVocabularyTreeLink).toBeNull();
done();
});
});
@@ -115,31 +110,20 @@ describe('SearchHierarchyFilterComponent', () => {
init();
});
it('should show the vocabulary tree link', (done) => {
it('should show the vocabulary tree link', () => {
expect(showVocabularyTreeLink).toBeTruthy();
done();
});
describe('when clicking the vocabulary tree link', () => {
beforeEach(async () => {
showVocabularyTreeLink.nativeElement.click();
});
it('should open the vocabulary tree modal', (done) => {
expect(ngbModal.open).toHaveBeenCalled();
done();
});
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(() => {
beforeEach(async () => {
showVocabularyTreeLink.nativeElement.click();
fixture.componentInstance.selectedValues$ = observableOf(
alreadySelectedValues.map(value => Object.assign(new FacetValue(), { value }))
);
@@ -148,6 +132,12 @@ describe('SearchHierarchyFilterComponent', () => {
}));
});
it('should open the vocabulary tree modal', () => {
expect(ngbModal.open).toHaveBeenCalled();
});
describe('when selecting a value from the vocabulary tree', () => {
it('should add a new search filter to the existing search filters', () => {
waitForAsync(() => expect(router.navigate).toHaveBeenCalledWith([testSearchLink], {
queryParams: {