fix(backend): Testen DatabaseLearningObjectProvider gerepareerd na refactoring.

This commit is contained in:
Gerald Schmittinger 2025-04-16 07:58:55 +02:00
parent ee9afab6ca
commit 51268af79c
20 changed files with 72 additions and 210 deletions

View file

@ -3,6 +3,7 @@ import { LearningObject } from '../../src/entities/content/learning-object.entit
import { LearningPath as LearningPathEntity } from '../../src/entities/content/learning-path.entity';
import { expect } from 'vitest';
import { FilteredLearningObject, LearningPath } from '@dwengo-1/common/interfaces/learning-content';
import {RequiredEntityData} from "@mikro-orm/core";
// Ignored properties because they belang for example to the class, not to the entity itself.
const IGNORE_PROPERTIES = ['parent'];
@ -60,9 +61,9 @@ export function expectToBeCorrectEntity<T extends object>(
/**
* Checks that filtered is the correct representation of original as FilteredLearningObject.
* @param filtered the representation as FilteredLearningObject
* @param original the original entity added to the database
* @param original the data of the entity in the database that was filtered.
*/
export function expectToBeCorrectFilteredLearningObject(filtered: FilteredLearningObject, original: LearningObject): void {
export function expectToBeCorrectFilteredLearningObject(filtered: FilteredLearningObject, original: RequiredEntityData<LearningObject>): void {
expect(filtered.uuid).toEqual(original.uuid);
expect(filtered.version).toEqual(original.version);
expect(filtered.language).toEqual(original.language);