test: students data
This commit is contained in:
		
							parent
							
								
									8f113d02b4
								
							
						
					
					
						commit
						db9b9ce2cd
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		|  | @ -2,6 +2,8 @@ import { setupTestApp } from '../../setup-tests.js'; | |||
| import { describe, it, expect, beforeAll } from 'vitest'; | ||||
| import { StudentRepository } from '../../../src/data/users/student-repository.js'; | ||||
| import { getStudentRepository } from '../../../src/data/repositories.js'; | ||||
| import { getNameOfJSDocTypedef } from 'typescript'; | ||||
| import { getNoordkaap } from '../../test_assets/users/students.testdata.js'; | ||||
| 
 | ||||
| const username = 'teststudent'; | ||||
| const firstName = 'John'; | ||||
|  | @ -21,11 +23,12 @@ describe('StudentRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should return student from the datbase', async () => { | ||||
|         const student = await studentRepository.findByUsername('Noordkaap'); | ||||
|         const expectation = getNoordkaap(); | ||||
|         const student = await studentRepository.findByUsername(expectation.username); | ||||
| 
 | ||||
|         expect(student).toBeTruthy(); | ||||
|         expect(student?.firstName).toBe('Stijn'); | ||||
|         expect(student?.lastName).toBe('Meuris'); | ||||
|         expect(student?.firstName).toBe(expectation.firstName); | ||||
|         expect(student?.lastName).toBe(expectation.lastName); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return the queried student after he was added', async () => { | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ import { testLearningObject01 } from './learning-objects.testdata'; | |||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||
| 
 | ||||
| export function makeTestAttachments(em: EntityManager): Attachment[] { | ||||
|     // prevent duplicate insertion
 | ||||
|     const lo = em.merge(LearningObject, testLearningObject01); | ||||
| 
 | ||||
|     attachment01 = em.create(Attachment, { | ||||
|  |  | |||
		Reference in a new issue
	
	 laurejablonski
						laurejablonski