2025SELab2-project-Dwengo/backend/tests/data/learning-paths.test.ts
2025-03-08 11:10:29 +01:00

29 lines
No EOL
1.1 KiB
TypeScript

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');
});
});