fix: Test- en linting-errors opgelost

This commit is contained in:
Gerald Schmittinger 2025-04-18 23:47:56 +02:00
parent ce5c0ea629
commit ba912c3ef0
20 changed files with 103 additions and 116 deletions

View file

@ -33,9 +33,10 @@ describe('AssignmentRepository', () => {
it('should find all by username of the responsible teacher', async () => {
const result = await assignmentRepository.findAllByResponsibleTeacher('testleerkracht1');
const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0));
const resultIds = result.map((it) => it.id)
.sort((a, b) => (a ?? 0) - (b ?? 0));
expect(resultIds).toEqual([1, 3, 4]);
expect(resultIds).toEqual([1, 1, 3, 4]);
});
it('should not find removed assignment', async () => {

View file

@ -91,9 +91,11 @@ describe('SubmissionRepository', () => {
expect(result[2].submissionNumber).toBe(3);
});
it("should find only the submissions for a certain learning object and assignment made for the user's group", async () => {
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!, 'Tool');
// (student Tool is in group #2)
it("should find only the submissions for a certain learning object and assignment made for the given group", async () => {
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 2);
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(
loId, group!
);
expect(result).toHaveLength(1);

View file

@ -41,7 +41,7 @@ describe('LearningObjectRepository', () => {
let newerExample: LearningObject;
it('should allow a learning object with the same id except a different version to be added', async () => {
let testLearningObject01Newer = structuredClone(testLearningObject01);
const testLearningObject01Newer = structuredClone(testLearningObject01);
testLearningObject01Newer.version = 10;
testLearningObject01Newer.title += " (nieuw)";
testLearningObject01Newer.uuid = v4();

View file

@ -3,6 +3,7 @@ import { getLearningPathRepository } from '../../../src/data/repositories';
import { LearningPathRepository } from '../../../src/data/content/learning-path-repository';
import { setupTestApp } from '../../setup-tests';
import { Language } from '@dwengo-1/common/util/language';
import {testLearningPath01} from "../../test_assets/content/learning-paths.testdata";
describe('LearningPathRepository', () => {
let learningPathRepository: LearningPathRepository;
@ -19,10 +20,12 @@ describe('LearningPathRepository', () => {
});
it('should return requested learning path', async () => {
const learningPath = await learningPathRepository.findByHruidAndLanguage('id01', Language.English);
const learningPath = await learningPathRepository.findByHruidAndLanguage(
testLearningPath01.hruid, testLearningPath01.language as Language
);
expect(learningPath).toBeTruthy();
expect(learningPath?.title).toBe('repertoire Tool');
expect(learningPath?.description).toBe('all about Tool');
expect(learningPath?.title).toBe(testLearningPath01.title);
expect(learningPath?.description).toBe(testLearningPath01.description);
});
});