refactor: tests class ids naar kleinere zonder hardcoding
This commit is contained in:
		
							parent
							
								
									81e0af28cc
								
							
						
					
					
						commit
						9643e25aed
					
				
					 15 changed files with 100 additions and 37 deletions
				
			
		|  | @ -4,6 +4,7 @@ import { GroupRepository } from '../../../src/data/assignments/group-repository' | |||
| import { getAssignmentRepository, getClassRepository, getGroupRepository } from '../../../src/data/repositories'; | ||||
| import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||
| import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||
| import {getClass01, getClass02} from "../../test_assets/classes/classes.testdata"; | ||||
| 
 | ||||
| describe('GroupRepository', () => { | ||||
|     let groupRepository: GroupRepository; | ||||
|  | @ -18,7 +19,8 @@ describe('GroupRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should return the requested group', async () => { | ||||
|         const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); | ||||
|         const id = getClass01().classId; | ||||
|         const class_ = await classRepository.findById(id); | ||||
|         const assignment = await assignmentRepository.findByClassAndId(class_!, 21000); | ||||
| 
 | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 21001); | ||||
|  | @ -27,7 +29,7 @@ describe('GroupRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should return all groups for assignment', async () => { | ||||
|         const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); | ||||
|         const class_ = await classRepository.findById(getClass01().classId); | ||||
|         const assignment = await assignmentRepository.findByClassAndId(class_!, 21000); | ||||
| 
 | ||||
|         const groups = await groupRepository.findAllGroupsForAssignment(assignment!); | ||||
|  | @ -37,7 +39,7 @@ describe('GroupRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should not find removed group', async () => { | ||||
|         const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89'); | ||||
|         const class_ = await classRepository.findById(getClass02().classId); | ||||
|         const assignment = await assignmentRepository.findByClassAndId(class_!, 21001); | ||||
| 
 | ||||
|         await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, 21001); | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl