style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									a824cdff94
								
							
						
					
					
						commit
						783c91b2e3
					
				
					 11 changed files with 112 additions and 93 deletions
				
			
		|  | @ -1,13 +1,9 @@ | |||
| import { beforeAll, beforeEach, describe, expect, it, Mock, vi } from 'vitest'; | ||||
| import { Request, Response } from 'express'; | ||||
| import { setupTestApp } from '../setup-tests.js'; | ||||
| import { | ||||
|     createInvitationHandler, | ||||
|     deleteInvitationForHandler, | ||||
|     getAllInvitationsHandler | ||||
| } from "../../src/controllers/teacher-invitations"; | ||||
| import {TeacherInvitationData} from "@dwengo-1/common/interfaces/teacher-invitation"; | ||||
| import {getClassHandler} from "../../src/controllers/classes"; | ||||
| import { createInvitationHandler, deleteInvitationForHandler, getAllInvitationsHandler } from '../../src/controllers/teacher-invitations'; | ||||
| import { TeacherInvitationData } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||
| import { getClassHandler } from '../../src/controllers/classes'; | ||||
| 
 | ||||
| describe('Teacher controllers', () => { | ||||
|     let req: Partial<Request>; | ||||
|  | @ -27,22 +23,22 @@ describe('Teacher controllers', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('Get teacher invitations by', async () => { | ||||
|         req = {params: {username: 'LimpBizkit'}, query: {by: 'true' }}; | ||||
|         req = { params: { username: 'LimpBizkit' }, query: { by: 'true' } }; | ||||
| 
 | ||||
|         await getAllInvitationsHandler(req as Request, res as Response); | ||||
| 
 | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({invitations: expect.anything()})); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ invitations: expect.anything() })); | ||||
| 
 | ||||
|         const result = jsonMock.mock.lastCall?.[0]; | ||||
|         expect(result.invitations).to.have.length.greaterThan(0); | ||||
|     }); | ||||
| 
 | ||||
|     it('Get teacher invitations for', async () => { | ||||
|         req = {params: {username: 'FooFighters'}, query: {by: 'false' }}; | ||||
|         req = { params: { username: 'FooFighters' }, query: { by: 'false' } }; | ||||
| 
 | ||||
|         await getAllInvitationsHandler(req as Request, res as Response); | ||||
| 
 | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({invitations: expect.anything()})); | ||||
|         expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ invitations: expect.anything() })); | ||||
| 
 | ||||
|         const result = jsonMock.mock.lastCall?.[0]; | ||||
|         expect(result.invitations).to.have.length.greaterThan(0); | ||||
|  | @ -50,8 +46,9 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|     it('Create and delete invitation', async () => { | ||||
|         const body = { | ||||
|             sender: 'LimpBizkit', receiver: 'testleerkracht1', | ||||
|             class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' | ||||
|             sender: 'LimpBizkit', | ||||
|             receiver: 'testleerkracht1', | ||||
|             class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89', | ||||
|         } as TeacherInvitationData; | ||||
|         req = { body }; | ||||
| 
 | ||||
|  | @ -59,9 +56,11 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|         req = { | ||||
|             params: { | ||||
|             sender: 'LimpBizkit', receiver: 'testleerkracht1', | ||||
|                 classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' | ||||
|             }, body: { accepted: 'false' } | ||||
|                 sender: 'LimpBizkit', | ||||
|                 receiver: 'testleerkracht1', | ||||
|                 classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89', | ||||
|             }, | ||||
|             body: { accepted: 'false' }, | ||||
|         }; | ||||
| 
 | ||||
|         await deleteInvitationForHandler(req as Request, res as Response); | ||||
|  | @ -69,8 +68,9 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|     it('Create and accept invitation', async () => { | ||||
|         const body = { | ||||
|             sender: 'LimpBizkit', receiver: 'testleerkracht1', | ||||
|             class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' | ||||
|             sender: 'LimpBizkit', | ||||
|             receiver: 'testleerkracht1', | ||||
|             class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89', | ||||
|         } as TeacherInvitationData; | ||||
|         req = { body }; | ||||
| 
 | ||||
|  | @ -78,16 +78,20 @@ describe('Teacher controllers', () => { | |||
| 
 | ||||
|         req = { | ||||
|             params: { | ||||
|                 sender: 'LimpBizkit', receiver: 'testleerkracht1', | ||||
|                 classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' | ||||
|             }, body: { accepted: 'true' } | ||||
|                 sender: 'LimpBizkit', | ||||
|                 receiver: 'testleerkracht1', | ||||
|                 classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89', | ||||
|             }, | ||||
|             body: { accepted: 'true' }, | ||||
|         }; | ||||
| 
 | ||||
|         await deleteInvitationForHandler(req as Request, res as Response); | ||||
| 
 | ||||
|         req = {params: { | ||||
|             id: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' | ||||
|         }}; | ||||
|         req = { | ||||
|             params: { | ||||
|                 id: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89', | ||||
|             }, | ||||
|         }; | ||||
| 
 | ||||
|         await getClassHandler(req as Request, res as Response); | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action