97049: Fixing inconsistent tests

This commit is contained in:
Jens Vannerum
2022-12-08 17:52:49 +01:00
parent a642a02663
commit 9cde4c119e

View File

@@ -1,5 +1,5 @@
import { SearchHierarchyFilterComponent } from './search-hierarchy-filter.component'; import { SearchHierarchyFilterComponent } from './search-hierarchy-filter.component';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { DebugElement, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; import { DebugElement, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { VocabularyService } from '../../../../../core/submission/vocabularies/vocabulary.service'; import { VocabularyService } from '../../../../../core/submission/vocabularies/vocabulary.service';
@@ -89,12 +89,12 @@ describe('SearchHierarchyFilterComponent', () => {
describe('if the vocabulary doesn\'t exist', () => { describe('if the vocabulary doesn\'t exist', () => {
beforeEach(() => { beforeEach(waitForAsync(() => {
spyOn(vocabularyService, 'searchTopEntries').and.returnValue(observableOf(new RemoteData( spyOn(vocabularyService, 'searchTopEntries').and.returnValue(observableOf(new RemoteData(
undefined, 0, 0, RequestEntryState.Error, undefined, undefined, 404 undefined, 0, 0, RequestEntryState.Error, undefined, undefined, 404
))); )));
init(); init();
}); }));
it('should not show the vocabulary tree link', () => { it('should not show the vocabulary tree link', () => {
expect(showVocabularyTreeLink).toBeNull(); expect(showVocabularyTreeLink).toBeNull();
@@ -103,12 +103,12 @@ describe('SearchHierarchyFilterComponent', () => {
describe('if the vocabulary exists', () => { describe('if the vocabulary exists', () => {
beforeEach(() => { beforeEach(waitForAsync(() => {
spyOn(vocabularyService, 'searchTopEntries').and.returnValue(observableOf(new RemoteData( spyOn(vocabularyService, 'searchTopEntries').and.returnValue(observableOf(new RemoteData(
undefined, 0, 0, RequestEntryState.Success, undefined, buildPaginatedList(new PageInfo(), []), 200 undefined, 0, 0, RequestEntryState.Success, undefined, buildPaginatedList(new PageInfo(), []), 200
))); )));
init(); init();
}); }));
it('should show the vocabulary tree link', () => { it('should show the vocabulary tree link', () => {
expect(showVocabularyTreeLink).toBeTruthy(); expect(showVocabularyTreeLink).toBeTruthy();