refactor: Cleanup
This commit is contained in:
parent
4bf82b09fa
commit
413220c54f
9 changed files with 53 additions and 34 deletions
|
@ -8,14 +8,4 @@ export default [
|
|||
globals: globals.node,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
files: ['tests/**/*.ts'],
|
||||
languageOptions: {
|
||||
globals: globals.node,
|
||||
},
|
||||
rules: {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"format": "prettier --write src/",
|
||||
"format-check": "prettier --check src/",
|
||||
"lint": "eslint . --fix",
|
||||
"test:unit": "vitest"
|
||||
"test:unit": "vitest --run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mikro-orm/core": "6.4.9",
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Request, Response } from 'express';
|
|||
import { createAssignment, getAllAssignments, getAssignment, getAssignmentsSubmissions } from '../services/assignments.js';
|
||||
import { AssignmentDTO } from '../interfaces/assignment.js';
|
||||
|
||||
// Typescript is annoy with with parameter forwarding from class.ts
|
||||
// Typescript is annoying with parameter forwarding from class.ts
|
||||
interface AssignmentParams {
|
||||
classid: string;
|
||||
id: string;
|
||||
|
|
|
@ -80,7 +80,7 @@ export async function getGroupSubmissionsHandler(req: Request, res: Response): P
|
|||
return;
|
||||
}
|
||||
|
||||
const groupId = Number(req.params.groupid!); // Can't be undefined
|
||||
const groupId = Number(req.params.groupid); // Can't be undefined
|
||||
|
||||
if (isNaN(groupId)) {
|
||||
res.status(400).json({ error: 'Group id must be a number' });
|
||||
|
|
|
@ -3,18 +3,16 @@ import { themes } from '../data/themes.js';
|
|||
import { loadTranslations } from '../util/translation-helper.js';
|
||||
|
||||
interface Translations {
|
||||
curricula_page: {
|
||||
[key: string]: { title: string; description?: string };
|
||||
};
|
||||
curricula_page: Record<string, { title: string; description?: string }>;
|
||||
}
|
||||
|
||||
export function getThemes(req: Request, res: Response): void {
|
||||
const language = (req.query.language as string)?.toLowerCase() || 'nl';
|
||||
const language = (req.query.language as string).toLowerCase() || 'nl';
|
||||
const translations = loadTranslations<Translations>(language);
|
||||
const themeList = themes.map((theme) => ({
|
||||
key: theme.title,
|
||||
title: translations.curricula_page[theme.title]?.title || theme.title,
|
||||
description: translations.curricula_page[theme.title]?.description,
|
||||
title: translations.curricula_page[theme.title].title || theme.title,
|
||||
description: translations.curricula_page[theme.title].description,
|
||||
image: `https://dwengo.org/images/curricula/logo_${theme.title}.png`,
|
||||
}));
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ async function getLearningObjectsForNodes(nodes: LearningPathNode[]): Promise<Ma
|
|||
version: node.version,
|
||||
language: node.language,
|
||||
})
|
||||
.then((learningObject) => ([node, learningObject] as [LearningPathNode, FilteredLearningObject | null]))
|
||||
.then((learningObject) => [node, learningObject] as [LearningPathNode, FilteredLearningObject | null])
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Language } from '../../../src/entities/content/language.js';
|
|||
function expectToHaveFoundPrecisely(expected: LearningPath, result: LearningPath[]): void {
|
||||
expect(result).toHaveProperty('length');
|
||||
expect(result.length).toBe(1);
|
||||
expectToBeCorrectEntity({ entity: result[0]! }, { entity: expected });
|
||||
expectToBeCorrectEntity({ entity: result[0] }, { entity: expected });
|
||||
}
|
||||
|
||||
function expectToHaveFoundNothing(result: LearningPath[]): void {
|
||||
|
|
|
@ -46,8 +46,6 @@ async function initPersonalizationTestData(): Promise<{
|
|||
await learningObjectRepo.save(learningContent.extraExerciseObject);
|
||||
await learningPathRepo.save(learningContent.learningPath);
|
||||
|
||||
console.log(await getSubmissionRepository().findAll({}));
|
||||
|
||||
const studentA = studentRepo.create({
|
||||
username: 'student_a',
|
||||
firstName: 'Aron',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue