diff --git a/src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts b/src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts index 4a59369fbb2f..53fa4615d343 100644 --- a/src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts +++ b/src/test/javascript/spec/component/standardized-competencies/admin-import-standardized-competencies.spec.ts @@ -158,13 +158,15 @@ describe('AdminImportStandardizedCompetenciesComponent', () => { }); it('should open details', () => { - const competencyToOpen = { id: 2, isVisible: true }; + component['importData'] = { knowledgeAreas: [], sources: [{ id: 1, title: 'any source' }] }; + const competencyToOpen = { id: 2, isVisible: true, sourceId: 1 }; const knowledgeAreaTitle = 'knowledgeArea'; component['openCompetencyDetails'](competencyToOpen, knowledgeAreaTitle); expect(component['selectedCompetency']).toEqual(competencyToOpen); expect(component['knowledgeAreaTitle']).toEqual(knowledgeAreaTitle); + expect(component['sourceString']).toBeTruthy(); }); it('should close details', () => { diff --git a/src/test/javascript/spec/component/standardized-competencies/course-import-standardized-competencies.spec.ts b/src/test/javascript/spec/component/standardized-competencies/course-import-standardized-competencies.spec.ts index ad2d3f650e54..4156ffb4980e 100644 --- a/src/test/javascript/spec/component/standardized-competencies/course-import-standardized-competencies.spec.ts +++ b/src/test/javascript/spec/component/standardized-competencies/course-import-standardized-competencies.spec.ts @@ -108,11 +108,13 @@ describe('CourseImportStandardizedCompetenciesComponent', () => { }); it('should open details', () => { - const competencyToOpen = { id: 2, isVisible: true, selected: true }; + component['sources'] = [{ id: 1, title: 'title1', author: 'author1' }]; + const competencyToOpen = { id: 2, isVisible: true, selected: true, sourceId: 1 }; component['openCompetencyDetails'](competencyToOpen); expect(component['selectedCompetency']).toEqual(competencyToOpen); + expect(component['sourceString']).toBeTruthy(); }); it('should close details', () => { diff --git a/src/test/javascript/spec/component/standardized-competencies/standardized-competency.service.spec.ts b/src/test/javascript/spec/component/standardized-competencies/standardized-competency.service.spec.ts index 24ad44c2fe47..a36ff6f9389d 100644 --- a/src/test/javascript/spec/component/standardized-competencies/standardized-competency.service.spec.ts +++ b/src/test/javascript/spec/component/standardized-competencies/standardized-competency.service.spec.ts @@ -1,7 +1,7 @@ import { HttpResponse } from '@angular/common/http'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed, fakeAsync, tick } from '@angular/core/testing'; -import { KnowledgeArea, KnowledgeAreaDTO, StandardizedCompetency } from 'app/entities/competency/standardized-competency.model'; +import { KnowledgeArea, KnowledgeAreaDTO, Source, StandardizedCompetency } from 'app/entities/competency/standardized-competency.model'; import { take } from 'rxjs'; import { CompetencyTaxonomy } from 'app/entities/competency.model'; import { StandardizedCompetencyService } from 'app/shared/standardized-competencies/standardized-competency.service'; @@ -107,4 +107,24 @@ describe('StandardizedCompetencyService', () => { expect(actualResult.body).toEqual(expectedResult); })); + + it('should get sources', fakeAsync(() => { + let actualSources = new HttpResponse(); + const expectedSources: Source[] = [ + { id: 1, title: 'source1' }, + { id: 2, title: 'source2' }, + ]; + const returnedFromService = [...expectedSources]; + + standardizedCompetencyService + .getSources() + .pipe(take(1)) + .subscribe((resp) => (actualSources = resp)); + + const req = httpTestingController.expectOne({ method: 'GET' }); + req.flush(returnedFromService); + tick(); + + expect(actualSources.body).toEqual(expectedSources); + })); });