style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									0158cc9342
								
							
						
					
					
						commit
						e773b2d611
					
				
					 4 changed files with 70 additions and 66 deletions
				
			
		|  | @ -2,13 +2,16 @@ import { setupTestApp } from '../setup-tests.js'; | |||
| import { describe, it, expect, beforeAll, beforeEach, vi, Mock } from 'vitest'; | ||||
| import { Request, Response } from 'express'; | ||||
| import { getAssignmentHandler, getAllAssignmentsHandler, getAssignmentsSubmissionsHandler } from '../../src/controllers/assignments.js'; | ||||
| import { NotFoundException } from "../../src/exceptions/not-found-exception"; | ||||
| import { getClass01 } from "../test_assets/classes/classes.testdata"; | ||||
| import { getAssignment01 } from "../test_assets/assignments/assignments.testdata"; | ||||
| import { NotFoundException } from '../../src/exceptions/not-found-exception'; | ||||
| import { getClass01 } from '../test_assets/classes/classes.testdata'; | ||||
| import { getAssignment01 } from '../test_assets/assignments/assignments.testdata'; | ||||
| 
 | ||||
| function createRequestObject(classid: string, assignmentid: string): { | ||||
| function createRequestObject( | ||||
|     classid: string, | ||||
|     assignmentid: string | ||||
| ): { | ||||
|     query: {}; | ||||
|     params: { classid: string; id: string } | ||||
|     params: { classid: string; id: string }; | ||||
| } { | ||||
|     return { | ||||
|         params: { | ||||
|  | @ -30,7 +33,7 @@ describe('Assignment controllers', () => { | |||
|         await setupTestApp(); | ||||
|     }); | ||||
| 
 | ||||
|     beforeEach(async () =>  { | ||||
|     beforeEach(async () => { | ||||
|         jsonMock = vi.fn(); | ||||
|         statusMock = vi.fn().mockReturnThis(); | ||||
| 
 | ||||
|  | @ -46,27 +49,26 @@ describe('Assignment controllers', () => { | |||
|         await expect(async () => getAssignmentHandler(req as Request, res as Response)).rejects.toThrow(NotFoundException); | ||||
|     }); | ||||
| 
 | ||||
| 	it('should return an assignment', async () => { | ||||
|         const assignment = getAssignment01(); | ||||
| 		req = createRequestObject(assignment.within.classId as string, (assignment.id ?? 1).toString()); | ||||
| 
 | ||||
| 		await getAssignmentHandler(req as Request, res as Response); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ assignment: expect.anything() })); | ||||
| 
 | ||||
|     }); | ||||
| 
 | ||||
| 	it('should return a list of assignments', async () => { | ||||
| 		req = createRequestObject(getClass01().classId as string, 'irrelevant'); | ||||
| 
 | ||||
| 		await getAllAssignmentsHandler(req as Request, res as Response); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ assignments: expect.anything() }));	}); | ||||
| 
 | ||||
| 	it('should return a list of submissions for an assignment', async () => { | ||||
|     it('should return an assignment', async () => { | ||||
|         const assignment = getAssignment01(); | ||||
|         req = createRequestObject(assignment.within.classId as string, (assignment.id ?? 1).toString()); | ||||
| 
 | ||||
|         await getAssignmentHandler(req as Request, res as Response); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ assignment: expect.anything() })); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return a list of assignments', async () => { | ||||
|         req = createRequestObject(getClass01().classId as string, 'irrelevant'); | ||||
| 
 | ||||
|         await getAllAssignmentsHandler(req as Request, res as Response); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ assignments: expect.anything() })); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return a list of submissions for an assignment', async () => { | ||||
|         const assignment = getAssignment01(); | ||||
|         req = createRequestObject(assignment.within.classId as string, (assignment.id ?? 1).toString()); | ||||
| 
 | ||||
|         await getAssignmentsSubmissionsHandler(req as Request, res as Response); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ submissions: expect.anything() })); | ||||
| 	}) | ||||
| }) | ||||
|     }); | ||||
| }); | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action