Merge branch 'dev' into refactor/common
This commit is contained in:
commit
a4408b5bc0
145 changed files with 3437 additions and 2822 deletions
|
@ -78,7 +78,7 @@ describe('DatabaseLearningObjectProvider', () => {
|
|||
});
|
||||
it('should throw an error if queried with a path identifier for which there is no learning path', async () => {
|
||||
await expect(
|
||||
(async () => {
|
||||
(async (): Promise<void> => {
|
||||
await databaseLearningObjectProvider.getLearningObjectIdsFromPath({
|
||||
hruid: 'non_existing_hruid',
|
||||
language: Language.Dutch,
|
||||
|
@ -97,7 +97,7 @@ describe('DatabaseLearningObjectProvider', () => {
|
|||
});
|
||||
it('should throw an error if queried with a path identifier for which there is no learning path', async () => {
|
||||
await expect(
|
||||
(async () => {
|
||||
(async (): Promise<void> => {
|
||||
await databaseLearningObjectProvider.getLearningObjectsFromPath({
|
||||
hruid: 'non_existing_hruid',
|
||||
language: Language.Dutch,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { LearningObject } from '../../../src/entities/content/learning-object.en
|
|||
import { getLearningObjectRepository, getLearningPathRepository } from '../../../src/data/repositories';
|
||||
import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example';
|
||||
import learningObjectService from '../../../src/services/learning-objects/learning-object-service';
|
||||
import { EnvVars, getEnvVar } from '../../../src/util/envvars';
|
||||
import { envVars, getEnvVar } from '../../../src/util/envVars';
|
||||
import { LearningPath } from '../../../src/entities/content/learning-path.entity';
|
||||
import learningPathExample from '../../test-assets/learning-paths/pn-werking-example';
|
||||
import { LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content';
|
||||
|
@ -79,7 +79,7 @@ describe('LearningObjectService', () => {
|
|||
expect(result).not.toBeNull();
|
||||
|
||||
const responseFromDwengoApi = await fetch(
|
||||
getEnvVar(EnvVars.LearningContentRepoApiBaseUrl) +
|
||||
getEnvVar(envVars.LearningContentRepoApiBaseUrl) +
|
||||
`/learningObject/getRaw?hruid=${DWENGO_TEST_LEARNING_OBJECT_ID.hruid}&language=${DWENGO_TEST_LEARNING_OBJECT_ID.language}&version=${DWENGO_TEST_LEARNING_OBJECT_ID.version}`
|
||||
);
|
||||
const responseHtml = await responseFromDwengoApi.text();
|
||||
|
|
|
@ -47,8 +47,6 @@ async function initPersonalizationTestData(): Promise<{
|
|||
await learningObjectRepo.save(learningContent.extraExerciseObject);
|
||||
await learningPathRepo.save(learningContent.learningPath);
|
||||
|
||||
console.log(await getSubmissionRepository().findAll({}));
|
||||
|
||||
const studentA = studentRepo.create({
|
||||
username: 'student_a',
|
||||
firstName: 'Aron',
|
||||
|
@ -129,7 +127,7 @@ describe('DatabaseLearningPathProvider', () => {
|
|||
|
||||
const learningObjectsOnPath = (
|
||||
await Promise.all(
|
||||
example.learningPath.nodes.map((node) =>
|
||||
example.learningPath.nodes.map(async (node) =>
|
||||
learningObjectService.getLearningObjectById({
|
||||
hruid: node.learningObjectHruid,
|
||||
version: node.version,
|
||||
|
|
|
@ -39,8 +39,8 @@ describe('LearningPathService', () => {
|
|||
expect(result.success).toBeTruthy();
|
||||
expect(result.data?.filter((it) => it.hruid === TEST_DWENGO_LEARNING_PATH_HRUID).length).not.toBe(0);
|
||||
expect(result.data?.filter((it) => it.hruid === example.learningPath.hruid).length).not.toBe(0);
|
||||
expect(result.data?.filter((it) => it.hruid === TEST_DWENGO_LEARNING_PATH_HRUID)[0].title).toEqual(TEST_DWENGO_LEARNING_PATH_TITLE);
|
||||
expect(result.data?.filter((it) => it.hruid === example.learningPath.hruid)[0].title).toEqual(example.learningPath.title);
|
||||
expect(result.data?.find((it) => it.hruid === TEST_DWENGO_LEARNING_PATH_HRUID)?.title).toEqual(TEST_DWENGO_LEARNING_PATH_TITLE);
|
||||
expect(result.data?.find((it) => it.hruid === example.learningPath.hruid)?.title).toEqual(example.learningPath.title);
|
||||
});
|
||||
it('should include both the learning objects from the Dwengo API and learning objects from the database in its response', async () => {
|
||||
const result = await learningPathService.fetchLearningPaths([example.learningPath.hruid], example.learningPath.language, 'the source');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue