feat: extra tests op nieuwe func student en teacher
This commit is contained in:
		
							parent
							
								
									65bce19fcf
								
							
						
					
					
						commit
						c7155fb438
					
				
					 2 changed files with 31 additions and 17 deletions
				
			
		|  | @ -16,6 +16,7 @@ import { BadRequestException } from '../../src/exceptions/bad-request-exception. | |||
| import { EntityAlreadyExistsException } from '../../src/exceptions/entity-already-exists-exception.js'; | ||||
| import { getStudentRequestsHandler } from '../../src/controllers/students.js'; | ||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||
| import {getClassHandler} from "../../src/controllers/classes"; | ||||
| 
 | ||||
| describe('Teacher controllers', () => { | ||||
|     let req: Partial<Request>; | ||||
|  | @ -168,7 +169,6 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|     it('Get join requests by class', async () => { | ||||
|         req = { | ||||
|             query: { username: 'LimpBizkit' }, | ||||
|             params: { classId: 'id02' }, | ||||
|         }; | ||||
| 
 | ||||
|  | @ -183,8 +183,7 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|     it('Update join request status', async () => { | ||||
|         req = { | ||||
|             query: { username: 'LimpBizkit', studentUsername: 'PinkFloyd' }, | ||||
|             params: { classId: 'id02' }, | ||||
|             params: { classId: 'id02', studentUsername: 'PinkFloyd'}, | ||||
|             body: { accepted: 'true' }, | ||||
|         }; | ||||
| 
 | ||||
|  | @ -200,5 +199,13 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|         const status: boolean = jsonMock.mock.lastCall?.[0].requests[0].status; | ||||
|         expect(status).toBeTruthy(); | ||||
| 
 | ||||
|         req = { | ||||
|             params: { id: 'id02' } | ||||
|         } | ||||
| 
 | ||||
|         await getClassHandler(req as Request, res as Response); | ||||
|         const students: string[] = jsonMock.mock.lastCall?.[0].class.students; | ||||
|         expect(students).contains("PinkFloyd"); | ||||
|     }); | ||||
| }); | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl