test(backend): Gewerkt aan testen voor DatabaseLearningPathProvider.
This commit is contained in:
parent
91e3b5ad91
commit
1f9e9ed70a
2 changed files with 55 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
import {AssertionError} from "node:assert";
|
||||
import {LearningObject} from "../../src/entities/content/learning-object.entity";
|
||||
import {FilteredLearningObject} from "../../src/interfaces/learning-content";
|
||||
import {FilteredLearningObject, LearningPath} from "../../src/interfaces/learning-content";
|
||||
import {LearningPath as LearningPathEntity} from "../../src/entities/content/learning-path.entity"
|
||||
import { expect } from "vitest";
|
||||
|
||||
// Ignored properties because they belang for example to the class, not to the entity itself.
|
||||
|
@ -91,3 +92,16 @@ export function expectToBeCorrectFilteredLearningObject(filtered: FilteredLearni
|
|||
expect(filtered.htmlUrl).toContain(`language=${original.language}`);
|
||||
expect(filtered.htmlUrl).toContain(`version=${original.version}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a learning path returned by a LearningPathRetriever, the LearningPathService or an API endpoint
|
||||
* is a correct representation of the given learning path entity.
|
||||
*
|
||||
* @param learningPath The learning path returned by the retriever, service or endpoint
|
||||
* @param expectedEntity The expected entity
|
||||
*/
|
||||
export function expectToBeCorrectLearningPath(learningPath: LearningPath, expectedEntity: LearningPathEntity) {
|
||||
expect(learningPath.hruid).toEqual(expectedEntity.hruid);
|
||||
expect(learningPath.language).toEqual(expectedEntity.language);
|
||||
expect(learningPath.description).toEqual(expectedEntity.description);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue