style: verander de structuur van de testmap

This commit is contained in:
Laure Jablonski 2025-03-10 21:01:09 +01:00
parent 5f55da987c
commit 678ced55ba
27 changed files with 854 additions and 706 deletions

View file

@ -0,0 +1,17 @@
import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core';
import { Attachment } from '../../../src/entities/content/attachment.entity';
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
export function makeTestAttachments(
em: EntityManager<IDatabaseDriver<Connection>>,
learningObjects: Array<LearningObject>
): Array<Attachment> {
const attachment01 = em.create(Attachment, {
learningObject: learningObjects[1],
sequenceNumber: 1,
mimeType: '',
content: Buffer.from(''),
});
return [attachment01];
}

View file

@ -0,0 +1,149 @@
import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core';
import {
ContentType,
LearningObject,
ReturnValue,
} from '../../../src/entities/content/learning-object.entity';
import { Language } from '../../../src/entities/content/language';
export function makeTestLearningObjects(
em: EntityManager<IDatabaseDriver<Connection>>
): Array<LearningObject> {
const returnValue: ReturnValue = new ReturnValue();
returnValue.callbackSchema = '';
returnValue.callbackUrl = '';
const learningObject01 = em.create(LearningObject, {
hruid: 'id01',
language: Language.English,
version: '1',
admins: [],
title: 'Undertow',
description: 'debute',
contentType: ContentType.Markdown,
keywords: [],
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
copyright: '',
license: '',
estimatedTime: 45,
returnValue: returnValue,
available: true,
contentLocation: '',
attachments: [],
content: Buffer.from(
"there's a shadow just behind me, shrouding every step i take, making every promise empty pointing every finger at me"
),
});
const learningObject02 = em.create(LearningObject, {
hruid: 'id02',
language: Language.English,
version: '1',
admins: [],
title: 'Aenema',
description: 'second album',
contentType: ContentType.Markdown,
keywords: [],
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
copyright: '',
license: '',
estimatedTime: 80,
returnValue: returnValue,
available: true,
contentLocation: '',
attachments: [],
content: Buffer.from(
"I've been crawling on my belly clearing out what could've been I've been wallowing in my own confused and insecure delusions"
),
});
const learningObject03 = em.create(LearningObject, {
hruid: 'id03',
language: Language.English,
version: '1',
admins: [],
title: 'love over gold',
description: 'third album',
contentType: ContentType.Markdown,
keywords: [],
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
copyright: '',
license: '',
estimatedTime: 55,
returnValue: returnValue,
available: true,
contentLocation: '',
attachments: [],
content: Buffer.from(
'he wrote me a prescription, he said you are depressed, \
but I am glad you came to see me to get this off your chest, \
come back and see me later next patient please \
send in another victim of industrial disease'
),
});
const learningObject04 = em.create(LearningObject, {
hruid: 'id04',
language: Language.English,
version: '1',
admins: [],
title: 'making movies',
description: 'fifth album',
contentType: ContentType.Markdown,
keywords: [],
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
copyright: '',
license: '',
estimatedTime: 55,
returnValue: returnValue,
available: true,
contentLocation: '',
attachments: [],
content: Buffer.from(
'I put my hand upon the lever \
Said let it rock and let it roll \
I had the one-arm bandit fever \
There was an arrow through my heart and my soul'
),
});
const learningObject05 = em.create(LearningObject, {
hruid: 'id05',
language: Language.English,
version: '1',
admins: [],
title: 'on every street',
description: 'sixth album',
contentType: ContentType.Markdown,
keywords: [],
teacherExclusive: false,
skosConcepts: [],
educationalGoals: [],
copyright: '',
license: '',
estimatedTime: 55,
returnValue: returnValue,
available: true,
contentLocation: '',
attachments: [],
content: Buffer.from(
'calling Elvis, is anybody home, calling elvis, I am here all alone'
),
});
return [
learningObject01,
learningObject02,
learningObject03,
learningObject04,
learningObject05,
];
}

View file

@ -0,0 +1,104 @@
import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core';
import {
LearningPath,
LearningPathNode,
LearningPathTransition,
} from '../../../src/entities/content/learning-path.entity';
import { Language } from '../../../src/entities/content/language';
export function makeTestLearningPaths(
em: EntityManager<IDatabaseDriver<Connection>>
): Array<LearningPath> {
const learningPathNode01: LearningPathNode = new LearningPathNode();
const learningPathNode02: LearningPathNode = new LearningPathNode();
const learningPathNode03: LearningPathNode = new LearningPathNode();
const learningPathNode04: LearningPathNode = new LearningPathNode();
const learningPathNode05: LearningPathNode = new LearningPathNode();
const transitions01: LearningPathTransition = new LearningPathTransition();
const transitions02: LearningPathTransition = new LearningPathTransition();
const transitions03: LearningPathTransition = new LearningPathTransition();
const transitions04: LearningPathTransition = new LearningPathTransition();
const transitions05: LearningPathTransition = new LearningPathTransition();
transitions01.condition = 'true';
transitions01.next = learningPathNode02;
transitions02.condition = 'true';
transitions02.next = learningPathNode02;
transitions03.condition = 'true';
transitions03.next = learningPathNode04;
transitions04.condition = 'true';
transitions04.next = learningPathNode05;
transitions05.condition = 'true';
transitions05.next = learningPathNode05;
learningPathNode01.instruction = '';
learningPathNode01.language = Language.English;
learningPathNode01.learningObjectHruid = 'id01';
learningPathNode01.startNode = true;
learningPathNode01.transitions = [transitions01];
learningPathNode01.version = '1';
learningPathNode02.instruction = '';
learningPathNode02.language = Language.English;
learningPathNode02.learningObjectHruid = 'id02';
learningPathNode02.startNode = false;
learningPathNode02.transitions = [transitions02];
learningPathNode02.version = '1';
learningPathNode03.instruction = '';
learningPathNode03.language = Language.English;
learningPathNode03.learningObjectHruid = 'id03';
learningPathNode03.startNode = true;
learningPathNode03.transitions = [transitions03];
learningPathNode03.version = '1';
learningPathNode04.instruction = '';
learningPathNode04.language = Language.English;
learningPathNode04.learningObjectHruid = 'id04';
learningPathNode04.startNode = false;
learningPathNode04.transitions = [transitions04];
learningPathNode04.version = '1';
learningPathNode05.instruction = '';
learningPathNode05.language = Language.English;
learningPathNode05.learningObjectHruid = 'id05';
learningPathNode05.startNode = false;
learningPathNode05.transitions = [transitions05];
learningPathNode05.version = '1';
const nodes01: Array<LearningPathNode> = [
// learningPathNode01,
// learningPathNode02,
];
const learningPath01 = em.create(LearningPath, {
hruid: 'id01',
language: Language.English,
admins: [],
title: 'repertoire Tool',
description: 'all about Tool',
image: '',
nodes: nodes01,
});
const nodes02: Array<LearningPathNode> = [
// learningPathNode03,
// learningPathNode04,
// learningPathNode05,
];
const learningPath02 = em.create(LearningPath, {
hruid: 'id02',
language: Language.English,
admins: [],
title: 'repertoire Dire Straits',
description: 'all about Dire Straits',
image: '',
nodes: nodes02,
});
return [learningPath01, learningPath02];
}