test: learning path repository is volledig getest

This commit is contained in:
Laure Jablonski 2025-03-08 11:10:29 +01:00
parent f6b648c9d9
commit 89deb96ae4
2 changed files with 100 additions and 8 deletions

View file

@ -0,0 +1,29 @@
import { beforeAll, describe, expect, it } from "vitest";
import { LearningPathRepository } from "../../src/data/content/learning-path-repository";
import { getLearningPathRepository } from "../../src/data/repositories";
import { setupTestApp } from "../setup-tests";
import { Language } from "../../src/entities/content/language";
describe('LearningPathRepository', () => {
let LearningPathRepository : LearningPathRepository;
beforeAll(async () => {
await setupTestApp();
LearningPathRepository = getLearningPathRepository();
});
it('should return nothing because no match for hruid and language', async() => {
const learningPath = await LearningPathRepository.findByHruidAndLanguage('hruid_path01', Language.Dutch);
expect(learningPath).toBeNull();
});
it('should return requested learning path', async() => {
const learningPath = await LearningPathRepository.findByHruidAndLanguage('hruid_path01', Language.English);
expect(learningPath).toBeTruthy();
expect(learningPath?.title).toBe('repertoire Tool');
expect(learningPath?.description).toBe('all about Tool');
});
});