fix(backend): Commentaar in PR geaddresseerd.
This commit is contained in:
		
							parent
							
								
									e3e6a03003
								
							
						
					
					
						commit
						699ebf62b8
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		|  | @ -65,14 +65,15 @@ async function fetchLearningObjects(learningPathId: LearningPathIdentifier, full | |||
|             return nodes.map((node) => node.learningobject_hruid); | ||||
|         } | ||||
| 
 | ||||
|         return await Promise.all( | ||||
|         const objects = await Promise.all( | ||||
|             nodes.map(async (node) => | ||||
|                 dwengoApiLearningObjectProvider.getLearningObjectById({ | ||||
|                     hruid: node.learningobject_hruid, | ||||
|                     language: learningPathId.language, | ||||
|                 }) | ||||
|             ) | ||||
|         ).then((objects) => objects.filter((obj): obj is FilteredLearningObject => obj !== null)); | ||||
|         ); | ||||
|         return objects.filter((obj): obj is FilteredLearningObject => obj !== null); | ||||
|     } catch (error) { | ||||
|         logger.error('❌ Error fetching learning objects:', error); | ||||
|         return []; | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ import { EnvVars, getEnvVar } from '../../../src/util/envvars'; | |||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity'; | ||||
| import learningPathExample from '../../test-assets/learning-paths/pn-werking-example'; | ||||
| 
 | ||||
| const TEST_LEARNING_OBJECT_TITLE = 'Test title'; | ||||
| const EXPECTED_DWENGO_LEARNING_OBJECT_TITLE = 'Werken met notebooks'; | ||||
| const DWENGO_TEST_LEARNING_OBJECT_ID: LearningObjectIdentifier = { | ||||
|     hruid: 'pn_werkingnotebooks', | ||||
|  | @ -78,11 +77,12 @@ describe('LearningObjectService', () => { | |||
|                 const result = await learningObjectService.getLearningObjectHTML(DWENGO_TEST_LEARNING_OBJECT_ID); | ||||
|                 expect(result).not.toBeNull(); | ||||
| 
 | ||||
|                 const htmlFromDwengoApi = await fetch( | ||||
|                 const responseFromDwengoApi = await fetch( | ||||
|                     getEnvVar(EnvVars.LearningContentRepoApiBaseUrl) + | ||||
|                         `/learningObject/getRaw?hruid=${DWENGO_TEST_LEARNING_OBJECT_ID.hruid}&language=${DWENGO_TEST_LEARNING_OBJECT_ID.language}&version=${DWENGO_TEST_LEARNING_OBJECT_ID.version}` | ||||
|                 ).then((it) => it.text()); | ||||
|                 expect(result).toEqual(htmlFromDwengoApi); | ||||
|                 ); | ||||
|                 const responseHtml = await responseFromDwengoApi.text(); | ||||
|                 expect(result).toEqual(responseHtml); | ||||
|             } | ||||
|         ); | ||||
|         it('returns null when queried with a non-existing identifier', async () => { | ||||
|  |  | |||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger