refactor(backend): no-unused-vars
This commit is contained in:
		
							parent
							
								
									c14d6c53da
								
							
						
					
					
						commit
						14e1508d00
					
				
					 37 changed files with 51 additions and 84 deletions
				
			
		|  | @ -1,5 +1,4 @@ | |||
| import { EnvVars, getEnvVar } from './util/envvars.js'; | ||||
| import { Language } from './entities/content/language.js'; | ||||
| 
 | ||||
| // API
 | ||||
| export const DWENGO_API_BASE = getEnvVar(EnvVars.LearningContentRepoApiBaseUrl); | ||||
|  |  | |||
|  | @ -9,13 +9,7 @@ import { | |||
|     getStudentGroups, | ||||
|     getStudentSubmissions, | ||||
| } from '../services/students.js'; | ||||
| import { ClassDTO } from '../interfaces/class.js'; | ||||
| import { getAllAssignments } from '../services/assignments.js'; | ||||
| import { getUserHandler } from './users.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| import { getStudentRepository } from '../data/repositories.js'; | ||||
| import { UserDTO } from '../interfaces/user.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| // TODO: accept arguments (full, ...)
 | ||||
|  | @ -23,8 +17,6 @@ import { getLogger } from '../logging/initalize.js'; | |||
| export async function getAllStudentsHandler(req: Request, res: Response): Promise<void> { | ||||
|     const full = req.query.full === 'true'; | ||||
| 
 | ||||
|     const studentRepository = getStudentRepository(); | ||||
| 
 | ||||
|     const students: StudentDTO[] | string[] = full ? await getAllStudents() : await getAllStudents(); | ||||
| 
 | ||||
|     if (!students) { | ||||
|  |  | |||
|  | @ -14,16 +14,12 @@ import { | |||
| import { ClassDTO } from '../interfaces/class.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| import { QuestionDTO, QuestionId } from '../interfaces/question.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { TeacherDTO } from '../interfaces/teacher.js'; | ||||
| import { getTeacherRepository } from '../data/repositories.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getAllTeachersHandler(req: Request, res: Response): Promise<void> { | ||||
|     const full = req.query.full === 'true'; | ||||
| 
 | ||||
|     const teacherRepository = getTeacherRepository(); | ||||
| 
 | ||||
|     const teachers: TeacherDTO[] | string[] = full ? await getAllTeachers() : await getAllTeachers(); | ||||
| 
 | ||||
|     if (!teachers) { | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ import { AnyEntity, EntityManager, EntityName, EntityRepository } from '@mikro-o | |||
| import { forkEntityManager } from '../orm.js'; | ||||
| import { StudentRepository } from './users/student-repository.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { User } from '../entities/users/user.entity.js'; | ||||
| import { UserRepository } from './users/user-repository.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { TeacherRepository } from './users/teacher-repository.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
|  |  | |||
|  | @ -1,9 +1,5 @@ | |||
| import { Student } from '../../entities/users/student.entity.js'; | ||||
| import { User } from '../../entities/users/user.entity.js'; | ||||
| import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||
| // Import { UserRepository } from './user-repository.js';
 | ||||
| 
 | ||||
| // Export class StudentRepository extends UserRepository<Student> {}
 | ||||
| 
 | ||||
| export class StudentRepository extends DwengoEntityRepository<Student> { | ||||
|     public findByUsername(username: string): Promise<Student | null> { | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| import { Teacher } from '../../entities/users/teacher.entity.js'; | ||||
| import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||
| import { UserRepository } from './user-repository.js'; | ||||
| 
 | ||||
| export class TeacherRepository extends DwengoEntityRepository<Teacher> { | ||||
|     public findByUsername(username: string): Promise<Teacher | null> { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Class } from '../classes/class.entity.js'; | ||||
| import { Group } from './group.entity.js'; | ||||
| import { Language } from '../content/language.js'; | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { Collection, Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | ||||
| import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | ||||
| import { Assignment } from './assignment.entity.js'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { GroupRepository } from '../../data/assignments/group-repository.js'; | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { FALLBACK_LANG } from '../config.js'; | |||
| import { Assignment } from '../entities/assignments/assignment.entity.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { languageMap } from '../entities/content/language.js'; | ||||
| import { GroupDTO, mapToGroupDTO } from './group.js'; | ||||
| import { GroupDTO } from './group.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export interface AssignmentDTO { | ||||
|  |  | |||
|  | @ -1,8 +1,6 @@ | |||
| import { Question } from '../entities/questions/question.entity.js'; | ||||
| import { UserDTO } from './user.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToStudentDTO, StudentDTO } from './student.js'; | ||||
| import { TeacherDTO } from './teacher.js'; | ||||
| 
 | ||||
| export interface QuestionDTO { | ||||
|     learningObjectIdentifier: LearningObjectIdentifier; | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ import { Submission } from '../entities/assignments/submission.entity.js'; | |||
| import { Language } from '../entities/content/language.js'; | ||||
| import { GroupDTO, mapToGroupDTO } from './group.js'; | ||||
| import { mapToStudent, mapToStudentDTO, StudentDTO } from './student.js'; | ||||
| import { mapToUser } from './user'; | ||||
| import { Student } from '../entities/users/student.entity'; | ||||
| 
 | ||||
| export interface SubmissionDTO { | ||||
|     learningObjectHruid: string; | ||||
|  |  | |||
|  | @ -100,7 +100,7 @@ function getAuthenticationInfo(req: AuthenticatedRequest): AuthenticationInfo | | |||
|  * Add the AuthenticationInfo object with the information about the current authentication to the request in order | ||||
|  * to avoid that the routers have to deal with the JWT token. | ||||
|  */ | ||||
| const addAuthenticationInfo = (req: AuthenticatedRequest, res: express.Response, next: express.NextFunction) => { | ||||
| const addAuthenticationInfo = (req: AuthenticatedRequest, _res: express.Response, next: express.NextFunction) => { | ||||
|     req.auth = getAuthenticationInfo(req); | ||||
|     next(); | ||||
| }; | ||||
|  | @ -115,7 +115,7 @@ export const authenticateUser = [verifyJwtToken, addAuthenticationInfo]; | |||
|  */ | ||||
| export const authorize = | ||||
|     (accessCondition: (auth: AuthenticationInfo) => boolean) => | ||||
|     (req: AuthenticatedRequest, res: express.Response, next: express.NextFunction): void => { | ||||
|     (req: AuthenticatedRequest, _res: express.Response, next: express.NextFunction): void => { | ||||
|         if (!req.auth) { | ||||
|             throw new UnauthorizedException(); | ||||
|         } else if (!accessCondition(req.auth)) { | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ router.get('/:id', getAssignmentHandler); | |||
| 
 | ||||
| router.get('/:id/submissions', getAssignmentsSubmissionsHandler); | ||||
| 
 | ||||
| router.get('/:id/questions', (req, res) => { | ||||
| router.get('/:id/questions', (_req, res) => { | ||||
|     res.json({ | ||||
|         questions: ['0'], | ||||
|     }); | ||||
|  |  | |||
|  | @ -4,21 +4,21 @@ import { authenticatedOnly, studentsOnly, teachersOnly } from '../middleware/aut | |||
| const router = express.Router(); | ||||
| 
 | ||||
| // Returns auth configuration for frontend
 | ||||
| router.get('/config', (req, res) => { | ||||
| router.get('/config', (_req, res) => { | ||||
|     res.json(getFrontendAuthConfig()); | ||||
| }); | ||||
| 
 | ||||
| router.get('/testAuthenticatedOnly', authenticatedOnly, (req, res) => { | ||||
| router.get('/testAuthenticatedOnly', authenticatedOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "student": [ ] }, { "teacher": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be authenticated!' }); | ||||
| }); | ||||
| 
 | ||||
| router.get('/testStudentsOnly', studentsOnly, (req, res) => { | ||||
| router.get('/testStudentsOnly', studentsOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "student": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be a student!' }); | ||||
| }); | ||||
| 
 | ||||
| router.get('/testTeachersOnly', teachersOnly, (req, res) => { | ||||
| router.get('/testTeachersOnly', teachersOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "teacher": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be a teacher!' }); | ||||
| }); | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ router.get('/:groupid', getGroupHandler); | |||
| router.get('/:groupid', getGroupSubmissionsHandler); | ||||
| 
 | ||||
| // The list of questions a group has made
 | ||||
| router.get('/:id/questions', (req, res) => { | ||||
| router.get('/:id/questions', (_req, res) => { | ||||
|     res.json({ | ||||
|         questions: ['0'], | ||||
|     }); | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ import { | |||
|     getStudentHandler, | ||||
|     getStudentSubmissionsHandler, | ||||
| } from '../controllers/students.js'; | ||||
| import { getStudentGroups } from '../services/students.js'; | ||||
| 
 | ||||
| const router = express.Router(); | ||||
| 
 | ||||
| // Root endpoint used to search objects
 | ||||
|  | @ -37,7 +37,7 @@ router.get('/:id/assignments', getStudentAssignmentsHandler); | |||
| router.get('/:id/groups', getStudentGroupsHandler); | ||||
| 
 | ||||
| // A list of questions a user has created
 | ||||
| router.get('/:id/questions', (req, res) => { | ||||
| router.get('/:id/questions', (_req, res) => { | ||||
|     res.json({ | ||||
|         questions: ['0'], | ||||
|     }); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { createSubmissionHandler, deleteSubmissionHandler, getSubmissionHandler | |||
| const router = express.Router({ mergeParams: true }); | ||||
| 
 | ||||
| // Root endpoint used to search objects
 | ||||
| router.get('/', (req, res) => { | ||||
| router.get('/', (_req, res) => { | ||||
|     res.json({ | ||||
|         submissions: ['0', '1'], | ||||
|     }); | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ router.get('/:username/students', getTeacherStudentHandler); | |||
| router.get('/:username/questions', getTeacherQuestionHandler); | ||||
| 
 | ||||
| // Invitations to other classes a teacher received
 | ||||
| router.get('/:id/invitations', (req, res) => { | ||||
| router.get('/:id/invitations', (_req, res) => { | ||||
|     res.json({ | ||||
|         invitations: ['0'], | ||||
|     }); | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ export async function createAssignment(classid: string, assignmentData: Assignme | |||
|         await assignmentRepository.save(newAssignment); | ||||
| 
 | ||||
|         return newAssignment; | ||||
|     } catch (e) { | ||||
|     } catch (_) { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,4 +1,3 @@ | |||
| import { GroupRepository } from '../data/assignments/group-repository.js'; | ||||
| import { | ||||
|     getAssignmentRepository, | ||||
|     getClassRepository, | ||||
|  |  | |||
|  | @ -86,6 +86,6 @@ export async function getLearningObjectsFromPath(hruid: string, language: string | |||
| export async function getLearningObjectIdsFromPath(hruid: string, language: string): Promise<string[]> { | ||||
|     return (await fetchLearningObjects(hruid, false, language)) as string[]; | ||||
| } | ||||
| function fetchLearningPaths(arg0: string[], language: string, arg2: string): LearningPathResponse | PromiseLike<LearningPathResponse> { | ||||
| function fetchLearningPaths(_arg0: string[], _language: string, _arg2: string): LearningPathResponse | PromiseLike<LearningPathResponse> { | ||||
|     throw new Error('Function not implemented.'); | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { Category } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class CategoryQuestionRenderer extends GIFTQuestionRenderer<Category> { | ||||
|     render(question: Category, questionNumber: number): string { | ||||
|     render(_question: Category, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'Category' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { Description } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class DescriptionQuestionRenderer extends GIFTQuestionRenderer<Description> { | ||||
|     render(question: Description, questionNumber: number): string { | ||||
|     render(_question: Description, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'Description' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { Matching } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class MatchingQuestionRenderer extends GIFTQuestionRenderer<Matching> { | ||||
|     render(question: Matching, questionNumber: number): string { | ||||
|     render(_question: Matching, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'Matching' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { Numerical } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class NumericalQuestionRenderer extends GIFTQuestionRenderer<Numerical> { | ||||
|     render(question: Numerical, questionNumber: number): string { | ||||
|     render(_question: Numerical, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'Numerical' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { ShortAnswer } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class ShortQuestionRenderer extends GIFTQuestionRenderer<ShortAnswer> { | ||||
|     render(question: ShortAnswer, questionNumber: number): string { | ||||
|     render(_question: ShortAnswer, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'ShortAnswer' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { TrueFalse } from 'gift-pegjs'; | |||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class TrueFalseQuestionRenderer extends GIFTQuestionRenderer<TrueFalse> { | ||||
|     render(question: TrueFalse, questionNumber: number): string { | ||||
|     render(_question: TrueFalse, _questionNumber: number): string { | ||||
|         throw new ProcessingError("The question type 'TrueFalse' is not supported yet!"); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -15,22 +15,20 @@ class MarkdownProcessor extends StringProcessor { | |||
|     } | ||||
| 
 | ||||
|     override renderFn(mdText: string) { | ||||
|         let html = ''; | ||||
|         try { | ||||
|             marked.use({ renderer: dwengoMarkedRenderer }); | ||||
|             html = marked(mdText, { async: false }); | ||||
|             html = this.replaceLinks(html); // Replace html image links path
 | ||||
|             const html = marked(mdText, { async: false }); | ||||
|             return this.replaceLinks(html); // Replace html image links path
 | ||||
|         } catch (e: any) { | ||||
|             throw new ProcessingError(e.message); | ||||
|         } | ||||
|         return html; | ||||
|     } | ||||
| 
 | ||||
|     replaceLinks(html: string) { | ||||
|         const proc = new InlineImageProcessor(); | ||||
|         html = html.replace( | ||||
|             /<img.*?src="(.*?)".*?(alt="(.*?)")?.*?(title="(.*?)")?.*?>/g, | ||||
|             (match: string, src: string, alt: string, altText: string, title: string, titleText: string) => proc.render(src) | ||||
|             (_match: string, src: string, _alt: string, _altText: string, _title: string, _titleText: string) => proc.render(src) | ||||
|         ); | ||||
|         return html; | ||||
|     } | ||||
|  |  | |||
|  | @ -5,8 +5,6 @@ import { Answer } from '../entities/questions/answer.entity.js'; | |||
| import { mapToAnswerDTO, mapToAnswerId } from '../interfaces/answer.js'; | ||||
| import { QuestionRepository } from '../data/questions/question-repository.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToUser } from '../interfaces/user.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { mapToStudent } from '../interfaces/student.js'; | ||||
| 
 | ||||
| export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> { | ||||
|  | @ -81,7 +79,7 @@ export async function createQuestion(questionDTO: QuestionDTO) { | |||
|             author, | ||||
|             content: questionDTO.content, | ||||
|         }); | ||||
|     } catch (e) { | ||||
|     } catch (_) { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|  | @ -99,7 +97,7 @@ export async function deleteQuestion(questionId: QuestionId) { | |||
| 
 | ||||
|     try { | ||||
|         await questionRepository.removeQuestionByLearningObjectAndSequenceNumber(questionId.learningObjectIdentifier, questionId.sequenceNumber); | ||||
|     } catch (e) { | ||||
|     } catch (_) { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,13 +1,10 @@ | |||
| import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { AssignmentDTO } from '../interfaces/assignment.js'; | ||||
| import { ClassDTO, mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { GroupDTO, mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | ||||
| import { mapToStudent, mapToStudentDTO, StudentDTO } from '../interfaces/student.js'; | ||||
| import { mapToSubmissionDTO, SubmissionDTO } from '../interfaces/submission.js'; | ||||
| import { getAllAssignments } from './assignments.js'; | ||||
| import { UserService } from './users.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getAllStudents(): Promise<StudentDTO[]> { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { getGroupRepository, getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToSubmission, mapToSubmissionDTO, SubmissionDTO } from '../interfaces/submission.js'; | ||||
|  | @ -28,7 +28,7 @@ export async function createSubmission(submissionDTO: SubmissionDTO) { | |||
|     try { | ||||
|         const newSubmission = await submissionRepository.create(submission); | ||||
|         await submissionRepository.save(newSubmission); | ||||
|     } catch (e) { | ||||
|     } catch (_) { | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,17 +1,8 @@ | |||
| import { | ||||
|     getClassRepository, | ||||
|     getLearningObjectRepository, | ||||
|     getQuestionRepository, | ||||
|     getStudentRepository, | ||||
|     getTeacherRepository, | ||||
| } from '../data/repositories.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { getClassRepository, getLearningObjectRepository, getQuestionRepository, getTeacherRepository } from '../data/repositories.js'; | ||||
| import { ClassDTO, mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { getClassStudents } from './class.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from '../interfaces/question.js'; | ||||
| import { UserService } from './users.js'; | ||||
| import { mapToUser } from '../interfaces/user.js'; | ||||
| import { mapToTeacher, mapToTeacherDTO, TeacherDTO } from '../interfaces/teacher.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ export function isValidHttpUrl(url: string): boolean { | |||
|     try { | ||||
|         const parsedUrl = new URL(url, 'http://test.be'); | ||||
|         return parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:'; | ||||
|     } catch (e) { | ||||
|     } catch (_) { | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -3,9 +3,7 @@ import { setupTestApp } from '../../setup-tests'; | |||
| import { ClassJoinRequestRepository } from '../../../src/data/classes/class-join-request-repository'; | ||||
| import { getClassJoinRequestRepository, getClassRepository, getStudentRepository } from '../../../src/data/repositories'; | ||||
| import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||
| import { Class } from '../../../src/entities/classes/class.entity'; | ||||
| import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||
| import { Student } from '../../../src/entities/users/student.entity'; | ||||
| 
 | ||||
| describe('ClassJoinRequestRepository', () => { | ||||
|     let classJoinRequestRepository: ClassJoinRequestRepository; | ||||
|  |  | |||
|  | @ -1,22 +1,19 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { QuestionRepository } from '../../../src/data/questions/question-repository'; | ||||
| import { getLearningObjectRepository, getQuestionRepository, getStudentRepository } from '../../../src/data/repositories'; | ||||
| import { getQuestionRepository, getStudentRepository } from '../../../src/data/repositories'; | ||||
| import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||
| import { Language } from '../../../src/entities/content/language'; | ||||
| 
 | ||||
| describe('QuestionRepository', () => { | ||||
|     let questionRepository: QuestionRepository; | ||||
|     let studentRepository: StudentRepository; | ||||
|     let learningObjectRepository: LearningObjectRepository; | ||||
| 
 | ||||
|     beforeAll(async () => { | ||||
|         await setupTestApp(); | ||||
|         questionRepository = getQuestionRepository(); | ||||
|         studentRepository = getStudentRepository(); | ||||
|         learningObjectRepository = getLearningObjectRepository(); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return all questions part of the given learning object', async () => { | ||||
|  |  | |||
|  | @ -79,6 +79,6 @@ export function createConditionTestLearningPathAndLearningObjects() { | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| const example: LearningPathExample = { | ||||
| const _example: LearningPathExample = { | ||||
|     createLearningPath: () => createConditionTestLearningPathAndLearningObjects().learningPath, | ||||
| }; | ||||
|  |  | |||
|  | @ -28,6 +28,23 @@ export default [ | |||
|             reportUnusedInlineConfigs: 'error', | ||||
|         }, | ||||
|         rules: { | ||||
|             'no-unused-expressions': 'off', | ||||
|             '@typescript-eslint/no-unused-expressions': 'warn', | ||||
|             'no-unused-vars': 'off', | ||||
|             '@typescript-eslint/no-unused-vars': [ | ||||
|                 'warn', | ||||
|                 { | ||||
|                     'args': 'all', | ||||
|                     'argsIgnorePattern': '^_', | ||||
|                     'caughtErrors': 'all', | ||||
|                     'caughtErrorsIgnorePattern': '^_', | ||||
|                     'varsIgnorePattern': '^_', | ||||
|                     'ignoreRestSiblings': true, | ||||
|                 } | ||||
|             ], | ||||
|             'no-use-before-define': 'off', | ||||
|             '@typescript-eslint/no-use-before-define': 'off', | ||||
| 
 | ||||
|             'no-await-in-loop': 'warn', | ||||
|             'no-constructor-return': 'error', | ||||
|             'no-duplicate-imports': 'error', | ||||
|  | @ -36,12 +53,8 @@ export default [ | |||
|             'no-template-curly-in-string': 'error', | ||||
|             'no-unmodified-loop-condition': 'warn', | ||||
|             'no-unreachable-loop': 'warn', | ||||
|             'no-use-before-define': 'error', | ||||
|             'no-useless-assignment': 'error', | ||||
| 
 | ||||
|             'no-unused-vars': 'off', | ||||
|             '@typescript-eslint/no-unused-vars': 'error', | ||||
| 
 | ||||
|             'arrow-body-style': ['warn', 'as-needed'], | ||||
|             'block-scoped-var': 'warn', | ||||
|             camelcase: 'warn', | ||||
|  |  | |||
		Reference in a new issue