style: verander de structuur van de testmap
This commit is contained in:
		
							parent
							
								
									5f55da987c
								
							
						
					
					
						commit
						678ced55ba
					
				
					 27 changed files with 854 additions and 706 deletions
				
			
		|  | @ -1,11 +1,11 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { AssignmentRepository } from '../../src/data/assignments/assignment-repository'; | import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||||
| import { | import { | ||||||
|     getAssignmentRepository, |     getAssignmentRepository, | ||||||
|     getClassRepository, |     getClassRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| 
 | 
 | ||||||
| describe('AssignmentRepository', () => { | describe('AssignmentRepository', () => { | ||||||
|     let assignmentRepository: AssignmentRepository; |     let assignmentRepository: AssignmentRepository; | ||||||
|  | @ -1,14 +1,13 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { GroupRepository } from '../../src/data/assignments/group-repository'; | import { GroupRepository } from '../../../src/data/assignments/group-repository'; | ||||||
| import { | import { | ||||||
|     getAssignmentRepository, |     getAssignmentRepository, | ||||||
|     getClassRepository, |     getClassRepository, | ||||||
|     getGroupRepository, |     getGroupRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { AssignmentRepository } from '../../src/data/assignments/assignment-repository'; | import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| import { Class } from '../../src/entities/classes/class.entity'; |  | ||||||
| 
 | 
 | ||||||
| describe('GroupRepository', () => { | describe('GroupRepository', () => { | ||||||
|     let groupRepository: GroupRepository; |     let groupRepository: GroupRepository; | ||||||
|  | @ -1,22 +1,19 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { SubmissionRepository } from '../../src/data/assignments/submission-repository'; | import { SubmissionRepository } from '../../../src/data/assignments/submission-repository'; | ||||||
| import { | import { | ||||||
|     getAssignmentRepository, |     getAssignmentRepository, | ||||||
|     getClassRepository, |     getClassRepository, | ||||||
|     getGroupRepository, |     getGroupRepository, | ||||||
|     getStudentRepository, |     getStudentRepository, | ||||||
|     getSubmissionRepository, |     getSubmissionRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { LearningObject } from '../../src/entities/content/learning-object.entity'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { LearningObjectIdentifier } from '../../src/entities/content/learning-object-identifier'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||||
| import { subscribe } from 'diagnostics_channel'; | import { GroupRepository } from '../../../src/data/assignments/group-repository'; | ||||||
| import { Student } from '../../src/entities/users/student.entity'; | import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||||
| import { StudentRepository } from '../../src/data/users/student-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| import { GroupRepository } from '../../src/data/assignments/group-repository'; |  | ||||||
| import { AssignmentRepository } from '../../src/data/assignments/assignment-repository'; |  | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; |  | ||||||
| 
 | 
 | ||||||
| describe('SubmissionRepository', () => { | describe('SubmissionRepository', () => { | ||||||
|     let submissionRepository: SubmissionRepository; |     let submissionRepository: SubmissionRepository; | ||||||
|  | @ -1,15 +1,15 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { ClassJoinRequestRepository } from '../../src/data/classes/class-join-request-repository'; | import { ClassJoinRequestRepository } from '../../../src/data/classes/class-join-request-repository'; | ||||||
| import { | import { | ||||||
|     getClassJoinRequestRepository, |     getClassJoinRequestRepository, | ||||||
|     getClassRepository, |     getClassRepository, | ||||||
|     getStudentRepository, |     getStudentRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { StudentRepository } from '../../src/data/users/student-repository'; | import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||||
| import { Class } from '../../src/entities/classes/class.entity'; | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| import { Student } from '../../src/entities/users/student.entity'; | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
| 
 | 
 | ||||||
| describe('ClassJoinRequestRepository', () => { | describe('ClassJoinRequestRepository', () => { | ||||||
|     let classJoinRequestRepository: ClassJoinRequestRepository; |     let classJoinRequestRepository: ClassJoinRequestRepository; | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { getClassRepository } from '../../src/data/repositories'; | import { getClassRepository } from '../../../src/data/repositories'; | ||||||
| 
 | 
 | ||||||
| describe('ClassRepository', () => { | describe('ClassRepository', () => { | ||||||
|     let classRepository: ClassRepository; |     let classRepository: ClassRepository; | ||||||
|  | @ -1,13 +1,13 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { | import { | ||||||
|     getClassRepository, |     getClassRepository, | ||||||
|     getTeacherInvitationRepository, |     getTeacherInvitationRepository, | ||||||
|     getTeacherRepository, |     getTeacherRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { TeacherInvitationRepository } from '../../src/data/classes/teacher-invitation-repository'; | import { TeacherInvitationRepository } from '../../../src/data/classes/teacher-invitation-repository'; | ||||||
| import { TeacherRepository } from '../../src/data/users/teacher-repository'; | import { TeacherRepository } from '../../../src/data/users/teacher-repository'; | ||||||
| import { ClassRepository } from '../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
| 
 | 
 | ||||||
| describe('ClassRepository', () => { | describe('ClassRepository', () => { | ||||||
|     let teacherInvitationRepository: TeacherInvitationRepository; |     let teacherInvitationRepository: TeacherInvitationRepository; | ||||||
|  | @ -1,13 +1,13 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { | import { | ||||||
|     getAttachmentRepository, |     getAttachmentRepository, | ||||||
|     getLearningObjectRepository, |     getLearningObjectRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { AttachmentRepository } from '../../src/data/content/attachment-repository'; | import { AttachmentRepository } from '../../../src/data/content/attachment-repository'; | ||||||
| import { LearningObjectRepository } from '../../src/data/content/learning-object-repository'; | import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||||
| import { LearningObjectIdentifier } from '../../src/entities/content/learning-object-identifier'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| 
 | 
 | ||||||
| describe('AttachmentRepository', () => { | describe('AttachmentRepository', () => { | ||||||
|     let attachmentRepository: AttachmentRepository; |     let attachmentRepository: AttachmentRepository; | ||||||
|  | @ -1,9 +1,9 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { LearningObjectRepository } from '../../src/data/content/learning-object-repository'; | import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||||
| import { getLearningObjectRepository } from '../../src/data/repositories'; | import { getLearningObjectRepository } from '../../../src/data/repositories'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { LearningObjectIdentifier } from '../../src/entities/content/learning-object-identifier'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| 
 | 
 | ||||||
| describe('LearningObjectRepository', () => { | describe('LearningObjectRepository', () => { | ||||||
|     let learningObjectRepository: LearningObjectRepository; |     let learningObjectRepository: LearningObjectRepository; | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { getLearningPathRepository } from '../../src/data/repositories'; | import { getLearningPathRepository } from '../../../src/data/repositories'; | ||||||
| import { LearningPathRepository } from '../../src/data/content/learning-path-repository'; | import { LearningPathRepository } from '../../../src/data/content/learning-path-repository'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| 
 | 
 | ||||||
| describe('LearningPathRepository', () => { | describe('LearningPathRepository', () => { | ||||||
|     let learningPathRepository: LearningPathRepository; |     let learningPathRepository: LearningPathRepository; | ||||||
|  | @ -1,16 +1,16 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { AnswerRepository } from '../../src/data/questions/answer-repository'; | import { AnswerRepository } from '../../../src/data/questions/answer-repository'; | ||||||
| import { | import { | ||||||
|     getAnswerRepository, |     getAnswerRepository, | ||||||
|     getQuestionRepository, |     getQuestionRepository, | ||||||
|     getTeacherRepository, |     getTeacherRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { QuestionRepository } from '../../src/data/questions/question-repository'; | import { QuestionRepository } from '../../../src/data/questions/question-repository'; | ||||||
| import { LearningObjectIdentifier } from '../../src/entities/content/learning-object-identifier'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| import { Question } from '../../src/entities/questions/question.entity'; | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
| import { TeacherRepository } from '../../src/data/users/teacher-repository'; | import { TeacherRepository } from '../../../src/data/users/teacher-repository'; | ||||||
| 
 | 
 | ||||||
| describe('AnswerRepository', () => { | describe('AnswerRepository', () => { | ||||||
|     let answerRepository: AnswerRepository; |     let answerRepository: AnswerRepository; | ||||||
|  | @ -1,16 +1,16 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { QuestionRepository } from '../../src/data/questions/question-repository'; | import { QuestionRepository } from '../../../src/data/questions/question-repository'; | ||||||
| import { | import { | ||||||
|     getLearningObjectRepository, |     getLearningObjectRepository, | ||||||
|     getQuestionRepository, |     getQuestionRepository, | ||||||
|     getStudentRepository, |     getStudentRepository, | ||||||
| } from '../../src/data/repositories'; | } from '../../../src/data/repositories'; | ||||||
| import { StudentRepository } from '../../src/data/users/student-repository'; | import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||||
| import { LearningObjectRepository } from '../../src/data/content/learning-object-repository'; | import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||||
| import { LearningObjectIdentifier } from '../../src/entities/content/learning-object-identifier'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { Language } from '../../src/entities/content/language'; | import { Language } from '../../../src/entities/content/language'; | ||||||
| import { Question } from '../../src/entities/questions/question.entity'; | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
| 
 | 
 | ||||||
| describe('QuestionRepository', () => { | describe('QuestionRepository', () => { | ||||||
|     let questionRepository: QuestionRepository; |     let questionRepository: QuestionRepository; | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| import { setupTestApp } from '../setup-tests.js'; | import { setupTestApp } from '../../setup-tests.js'; | ||||||
| import { Student } from '../../src/entities/users/student.entity.js'; | import { Student } from '../../../src/entities/users/student.entity.js'; | ||||||
| import { describe, it, expect, beforeAll } from 'vitest'; | import { describe, it, expect, beforeAll } from 'vitest'; | ||||||
| import { StudentRepository } from '../../src/data/users/student-repository.js'; | import { StudentRepository } from '../../../src/data/users/student-repository.js'; | ||||||
| import { getStudentRepository } from '../../src/data/repositories.js'; | import { getStudentRepository } from '../../../src/data/repositories.js'; | ||||||
| 
 | 
 | ||||||
| const username = 'teststudent'; | const username = 'teststudent'; | ||||||
| const firstName = 'John'; | const firstName = 'John'; | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| import { setupTestApp } from '../setup-tests.js'; |  | ||||||
| import { describe, it, expect, beforeAll } from 'vitest'; | import { describe, it, expect, beforeAll } from 'vitest'; | ||||||
| import { TeacherRepository } from '../../src/data/users/teacher-repository.js'; | import { TeacherRepository } from '../../../src/data/users/teacher-repository'; | ||||||
| import { Teacher } from '../../src/entities/users/teacher.entity.js'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { getTeacherRepository } from '../../src/data/repositories.js'; | import { getTeacherRepository } from '../../../src/data/repositories'; | ||||||
|  | import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||||
| 
 | 
 | ||||||
| const username = 'testteacher'; | const username = 'testteacher'; | ||||||
| const firstName = 'John'; | const firstName = 'John'; | ||||||
|  | @ -1,30 +1,18 @@ | ||||||
| import { Assignment } from '../src/entities/assignments/assignment.entity.js'; |  | ||||||
| import { Group } from '../src/entities/assignments/group.entity.js'; |  | ||||||
| import { Submission } from '../src/entities/assignments/submission.entity.js'; |  | ||||||
| import { |  | ||||||
|     ClassJoinRequest, |  | ||||||
|     ClassJoinRequestStatus, |  | ||||||
| } from '../src/entities/classes/class-join-request.entity.js'; |  | ||||||
| import { Class } from '../src/entities/classes/class.entity.js'; |  | ||||||
| import { TeacherInvitation } from '../src/entities/classes/teacher-invitation.entity.js'; |  | ||||||
| import { Attachment } from '../src/entities/content/attachment.entity.js'; |  | ||||||
| import { Language } from '../src/entities/content/language.js'; |  | ||||||
| import { |  | ||||||
|     ContentType, |  | ||||||
|     LearningObject, |  | ||||||
|     ReturnValue, |  | ||||||
| } from '../src/entities/content/learning-object.entity.js'; |  | ||||||
| import { |  | ||||||
|     LearningPath, |  | ||||||
|     LearningPathNode, |  | ||||||
|     LearningPathTransition, |  | ||||||
| } from '../src/entities/content/learning-path.entity.js'; |  | ||||||
| import { Answer } from '../src/entities/questions/answer.entity.js'; |  | ||||||
| import { Question } from '../src/entities/questions/question.entity.js'; |  | ||||||
| import { Student } from '../src/entities/users/student.entity.js'; |  | ||||||
| import { Teacher } from '../src/entities/users/teacher.entity.js'; |  | ||||||
| import { forkEntityManager, initORM } from '../src/orm.js'; | import { forkEntityManager, initORM } from '../src/orm.js'; | ||||||
| import dotenv from 'dotenv'; | import dotenv from 'dotenv'; | ||||||
|  | import { makeTestStudents } from './test_assets/users/students.testdata.js'; | ||||||
|  | import { makeTestTeachers } from './test_assets/users/teachers.testdata.js'; | ||||||
|  | import { makeTestLearningObjects } from './test_assets/content/learning-objects.testdata.js'; | ||||||
|  | import { makeTestLearningPaths } from './test_assets/content/learning-paths.testdata.js'; | ||||||
|  | import { makeTestClasses } from './test_assets/classes/classes.testdata.js'; | ||||||
|  | import { makeTestAssignemnts } from './test_assets/assignments/assignments.testdata.js'; | ||||||
|  | import { makeTestGroups } from './test_assets/assignments/groups.testdata.js'; | ||||||
|  | import { makeTestTeacherInvitations } from './test_assets/classes/teacher-invitations.testdata.js'; | ||||||
|  | import { makeTestClassJoinRequests } from './test_assets/classes/class-join-requests.testdata.js'; | ||||||
|  | import { makeTestAttachments } from './test_assets/content/attachments.testdata.js'; | ||||||
|  | import { makeTestQuestions } from './test_assets/questions/questions.testdata.js'; | ||||||
|  | import { makeTestAnswers } from './test_assets/questions/answers.testdata.js'; | ||||||
|  | import { makeTestSubmissions } from './test_assets/assignments/submission.testdata.js'; | ||||||
| 
 | 
 | ||||||
| export async function setupTestApp() { | export async function setupTestApp() { | ||||||
|     dotenv.config({ path: '.env.test' }); |     dotenv.config({ path: '.env.test' }); | ||||||
|  | @ -32,616 +20,44 @@ export async function setupTestApp() { | ||||||
| 
 | 
 | ||||||
|     const em = forkEntityManager(); |     const em = forkEntityManager(); | ||||||
| 
 | 
 | ||||||
|     const student01 = em.create(Student, { |     const students = makeTestStudents(em); | ||||||
|         username: 'Noordkaap', |     const teachers = makeTestTeachers(em); | ||||||
|         firstName: 'Stijn', |     const learningObjects = makeTestLearningObjects(em); | ||||||
|         lastName: 'Meuris', |     const learningPaths = makeTestLearningPaths(em); | ||||||
|     }); |     const classes = makeTestClasses(em, students, teachers); | ||||||
|  |     const assignments = makeTestAssignemnts(em, classes); | ||||||
|  |     const groups = makeTestGroups(em, students, assignments); | ||||||
| 
 | 
 | ||||||
|     const student02 = em.create(Student, { |     assignments[0].groups = groups.slice(0, 3); | ||||||
|         username: 'DireStraits', |     assignments[1].groups = groups.slice(3, 4); | ||||||
|         firstName: 'Mark', |  | ||||||
|         lastName: 'Knopfler', |  | ||||||
|     }); |  | ||||||
| 
 | 
 | ||||||
|     const student03 = em.create(Student, { |     const teacherInvitations = makeTestTeacherInvitations( | ||||||
|         username: 'Tool', |         em, | ||||||
|         firstName: 'Maynard', |         teachers, | ||||||
|         lastName: 'Keenan', |         classes | ||||||
|     }); |     ); | ||||||
|  |     const classJoinRequests = makeTestClassJoinRequests(em, students, classes); | ||||||
|  |     const attachments = makeTestAttachments(em, learningObjects); | ||||||
| 
 | 
 | ||||||
|     const student04 = em.create(Student, { |     learningObjects[1].attachments = attachments; | ||||||
|         username: 'SmashingPumpkins', |  | ||||||
|         firstName: 'Billy', |  | ||||||
|         lastName: 'Corgan', |  | ||||||
|     }); |  | ||||||
| 
 | 
 | ||||||
|     const student05 = em.create(Student, { |     const questions = makeTestQuestions(em, students); | ||||||
|         username: 'PinkFloyd', |     const answers = makeTestAnswers(em, teachers, questions); | ||||||
|         firstName: 'David', |     const submissions = makeTestSubmissions(em, students, groups); | ||||||
|         lastName: 'Gilmoure', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const student06 = em.create(Student, { |  | ||||||
|         username: 'TheDoors', |  | ||||||
|         firstName: 'Jim', |  | ||||||
|         lastName: 'Morisson', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const student07 = em.create(Student, { |  | ||||||
|         username: 'Nirvana', |  | ||||||
|         firstName: 'Kurt', |  | ||||||
|         lastName: 'Cobain', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacher01 = em.create(Teacher, { |  | ||||||
|         username: 'FooFighters', |  | ||||||
|         firstName: 'Dave', |  | ||||||
|         lastName: 'Grohl', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacher02 = em.create(Teacher, { |  | ||||||
|         username: 'LimpBizkit', |  | ||||||
|         firstName: 'Fred', |  | ||||||
|         lastName: 'Durst', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacher03 = em.create(Teacher, { |  | ||||||
|         username: 'Staind', |  | ||||||
|         firstName: 'Aaron', |  | ||||||
|         lastName: 'Lewis', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacher04 = em.create(Teacher, { |  | ||||||
|         username: 'ZesdeMetaal', |  | ||||||
|         firstName: 'Wannes', |  | ||||||
|         lastName: 'Cappelle', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     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' |  | ||||||
|         ), |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     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, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const studentsClass01: Array<Student> = [ |  | ||||||
|         student01, |  | ||||||
|         student02, |  | ||||||
|         student03, |  | ||||||
|         student04, |  | ||||||
|         student05, |  | ||||||
|         student06, |  | ||||||
|     ]; |  | ||||||
|     const teacherClass01: Array<Teacher> = [teacher01]; |  | ||||||
| 
 |  | ||||||
|     const class01 = em.create(Class, { |  | ||||||
|         classId: 'id01', |  | ||||||
|         displayName: 'class01', |  | ||||||
|         teachers: teacherClass01, |  | ||||||
|         students: studentsClass01, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const studentsClass02: Array<Student> = [student01, student02, student04]; |  | ||||||
|     const teacherClass02: Array<Teacher> = [teacher02]; |  | ||||||
|     const class02 = em.create(Class, { |  | ||||||
|         classId: 'id02', |  | ||||||
|         displayName: 'class02', |  | ||||||
|         teachers: teacherClass02, |  | ||||||
|         students: studentsClass02, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const studentsClass03: Array<Student> = [student02, student03, student04]; |  | ||||||
|     const teacherClass03: Array<Teacher> = [teacher03]; |  | ||||||
|     const class03 = em.create(Class, { |  | ||||||
|         classId: 'id03', |  | ||||||
|         displayName: 'class03', |  | ||||||
|         teachers: teacherClass03, |  | ||||||
|         students: studentsClass03, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const studentsClass04: Array<Student> = [student01, student02]; |  | ||||||
|     const teacherClass04: Array<Teacher> = [teacher03]; |  | ||||||
|     const class04 = em.create(Class, { |  | ||||||
|         classId: 'id04', |  | ||||||
|         displayName: 'class04', |  | ||||||
|         teachers: teacherClass04, |  | ||||||
|         students: studentsClass04, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const assignment01 = em.create(Assignment, { |  | ||||||
|         within: class01, |  | ||||||
|         id: 1, |  | ||||||
|         title: 'dire straits', |  | ||||||
|         description: 'reading', |  | ||||||
|         learningPathHruid: 'id02', |  | ||||||
|         learningPathLanguage: Language.English, |  | ||||||
|         groups: [], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const assignment02 = em.create(Assignment, { |  | ||||||
|         within: class02, |  | ||||||
|         id: 2, |  | ||||||
|         title: 'tool', |  | ||||||
|         description: 'reading', |  | ||||||
|         learningPathHruid: 'id01', |  | ||||||
|         learningPathLanguage: Language.English, |  | ||||||
|         groups: [], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const assignment03 = em.create(Assignment, { |  | ||||||
|         within: class01, |  | ||||||
|         id: 3, |  | ||||||
|         title: 'delete', |  | ||||||
|         description: 'will be deleted', |  | ||||||
|         learningPathHruid: 'id02', |  | ||||||
|         learningPathLanguage: Language.English, |  | ||||||
|         groups: [], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const group01 = em.create(Group, { |  | ||||||
|         assignment: assignment01, |  | ||||||
|         groupNumber: 1, |  | ||||||
|         members: [student01, student02], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const group02 = em.create(Group, { |  | ||||||
|         assignment: assignment01, |  | ||||||
|         groupNumber: 2, |  | ||||||
|         members: [student03, student04], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const group03 = em.create(Group, { |  | ||||||
|         assignment: assignment01, |  | ||||||
|         groupNumber: 3, |  | ||||||
|         members: [student05, student06], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const group04 = em.create(Group, { |  | ||||||
|         assignment: assignment02, |  | ||||||
|         groupNumber: 4, |  | ||||||
|         members: [student04], |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     assignment01.groups = [group01, group02, group03]; |  | ||||||
|     assignment02.groups = [group04]; |  | ||||||
| 
 |  | ||||||
|     const teacherInvitation01 = em.create(TeacherInvitation, { |  | ||||||
|         sender: teacher02, |  | ||||||
|         receiver: teacher01, |  | ||||||
|         class: class02, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacherInvitation02 = em.create(TeacherInvitation, { |  | ||||||
|         sender: teacher02, |  | ||||||
|         receiver: teacher03, |  | ||||||
|         class: class02, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacherInvitation03 = em.create(TeacherInvitation, { |  | ||||||
|         sender: teacher03, |  | ||||||
|         receiver: teacher01, |  | ||||||
|         class: class03, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const teacherInvitation04 = em.create(TeacherInvitation, { |  | ||||||
|         sender: teacher01, |  | ||||||
|         receiver: teacher02, |  | ||||||
|         class: class01, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const classJoinRequest01 = em.create(ClassJoinRequest, { |  | ||||||
|         requester: student05, |  | ||||||
|         class: class02, |  | ||||||
|         status: ClassJoinRequestStatus.Open, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const classJoinRequest02 = em.create(ClassJoinRequest, { |  | ||||||
|         requester: student03, |  | ||||||
|         class: class02, |  | ||||||
|         status: ClassJoinRequestStatus.Open, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const classJoinRequest03 = em.create(ClassJoinRequest, { |  | ||||||
|         requester: student05, |  | ||||||
|         class: class03, |  | ||||||
|         status: ClassJoinRequestStatus.Open, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const classJoinRequest04 = em.create(ClassJoinRequest, { |  | ||||||
|         requester: student04, |  | ||||||
|         class: class03, |  | ||||||
|         status: ClassJoinRequestStatus.Open, |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const attachment01 = em.create(Attachment, { |  | ||||||
|         learningObject: learningObject02, |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         mimeType: '', |  | ||||||
|         content: Buffer.from(''), |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     learningObject02.attachments = [attachment01]; |  | ||||||
| 
 |  | ||||||
|     const question01 = em.create(Question, { |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         learningObjectHruid: 'id05', |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         author: student01, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'question', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const question02 = em.create(Question, { |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         learningObjectHruid: 'id05', |  | ||||||
|         sequenceNumber: 2, |  | ||||||
|         author: student03, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'question', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const question03 = em.create(Question, { |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         learningObjectHruid: 'id04', |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         author: student01, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'question', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const question04 = em.create(Question, { |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         learningObjectHruid: 'id01', |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         author: student02, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'question', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const answer01 = em.create(Answer, { |  | ||||||
|         author: teacher01, |  | ||||||
|         toQuestion: question02, |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'answer', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const answer02 = em.create(Answer, { |  | ||||||
|         author: teacher01, |  | ||||||
|         toQuestion: question02, |  | ||||||
|         sequenceNumber: 2, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'answer2', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const answer03 = em.create(Answer, { |  | ||||||
|         author: teacher02, |  | ||||||
|         toQuestion: question04, |  | ||||||
|         sequenceNumber: 1, |  | ||||||
|         timestamp: new Date(), |  | ||||||
|         content: 'answer3', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const submission01 = em.create(Submission, { |  | ||||||
|         learningObjectHruid: 'id03', |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         submissionNumber: 1, |  | ||||||
|         submitter: student01, |  | ||||||
|         submissionTime: new Date(2025, 2, 20), |  | ||||||
|         onBehalfOf: group01, |  | ||||||
|         content: 'sub1', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const submission02 = em.create(Submission, { |  | ||||||
|         learningObjectHruid: 'id03', |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         submissionNumber: 2, |  | ||||||
|         submitter: student01, |  | ||||||
|         submissionTime: new Date(2025, 2, 25), |  | ||||||
|         onBehalfOf: group01, |  | ||||||
|         content: '', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const submission03 = em.create(Submission, { |  | ||||||
|         learningObjectHruid: 'id02', |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         submissionNumber: 1, |  | ||||||
|         submitter: student01, |  | ||||||
|         submissionTime: new Date(2025, 2, 20), |  | ||||||
|         content: '', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const submission04 = em.create(Submission, { |  | ||||||
|         learningObjectHruid: 'id02', |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         submissionNumber: 2, |  | ||||||
|         submitter: student01, |  | ||||||
|         submissionTime: new Date(2025, 2, 25), |  | ||||||
|         content: '', |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const submission05 = em.create(Submission, { |  | ||||||
|         learningObjectHruid: 'id01', |  | ||||||
|         learningObjectLanguage: Language.English, |  | ||||||
|         learningObjectVersion: '1', |  | ||||||
|         submissionNumber: 1, |  | ||||||
|         submitter: student02, |  | ||||||
|         submissionTime: new Date(2025, 2, 20), |  | ||||||
|         content: '', |  | ||||||
|     }); |  | ||||||
| 
 | 
 | ||||||
|     await em.persistAndFlush([ |     await em.persistAndFlush([ | ||||||
|         student01, |         ...students, | ||||||
|         student02, |         ...teachers, | ||||||
|         student03, |         ...learningObjects, | ||||||
|         student04, |         ...learningPaths, | ||||||
|         student05, |         ...classes, | ||||||
|         student06, |         ...assignments, | ||||||
|         student07, |         ...groups, | ||||||
|         teacher01, |         ...teacherInvitations, | ||||||
|         teacher02, |         ...classJoinRequests, | ||||||
|         teacher03, |         ...attachments, | ||||||
|         teacher04, |         ...questions, | ||||||
|         class01, |         ...answers, | ||||||
|         class02, |         ...submissions, | ||||||
|         class03, |  | ||||||
|         class04, |  | ||||||
|         learningObject01, |  | ||||||
|         learningObject02, |  | ||||||
|         learningObject03, |  | ||||||
|         learningObject04, |  | ||||||
|         learningObject05, |  | ||||||
|         learningPath01, |  | ||||||
|         learningPath02, |  | ||||||
|         attachment01, |  | ||||||
|         classJoinRequest01, |  | ||||||
|         classJoinRequest02, |  | ||||||
|         classJoinRequest03, |  | ||||||
|         classJoinRequest04, |  | ||||||
|         teacherInvitation01, |  | ||||||
|         teacherInvitation02, |  | ||||||
|         teacherInvitation03, |  | ||||||
|         teacherInvitation04, |  | ||||||
|         assignment01, |  | ||||||
|         assignment02, |  | ||||||
|         assignment03, |  | ||||||
|         group01, |  | ||||||
|         group02, |  | ||||||
|         group03, |  | ||||||
|         group04, |  | ||||||
|         question01, |  | ||||||
|         question02, |  | ||||||
|         question03, |  | ||||||
|         question04, |  | ||||||
|         answer01, |  | ||||||
|         answer02, |  | ||||||
|         answer03, |  | ||||||
|         submission01, |  | ||||||
|         submission02, |  | ||||||
|         submission03, |  | ||||||
|         submission04, |  | ||||||
|         submission05, |  | ||||||
|     ]); |     ]); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -0,0 +1,41 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Assignment } from '../../../src/entities/assignments/assignment.entity'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | import { Language } from '../../../src/entities/content/language'; | ||||||
|  | 
 | ||||||
|  | export function makeTestAssignemnts( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     classes: Array<Class> | ||||||
|  | ): Array<Assignment> { | ||||||
|  |     const assignment01 = em.create(Assignment, { | ||||||
|  |         within: classes[0], | ||||||
|  |         id: 1, | ||||||
|  |         title: 'dire straits', | ||||||
|  |         description: 'reading', | ||||||
|  |         learningPathHruid: 'id02', | ||||||
|  |         learningPathLanguage: Language.English, | ||||||
|  |         groups: [], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const assignment02 = em.create(Assignment, { | ||||||
|  |         within: classes[1], | ||||||
|  |         id: 2, | ||||||
|  |         title: 'tool', | ||||||
|  |         description: 'reading', | ||||||
|  |         learningPathHruid: 'id01', | ||||||
|  |         learningPathLanguage: Language.English, | ||||||
|  |         groups: [], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const assignment03 = em.create(Assignment, { | ||||||
|  |         within: classes[0], | ||||||
|  |         id: 3, | ||||||
|  |         title: 'delete', | ||||||
|  |         description: 'will be deleted', | ||||||
|  |         learningPathHruid: 'id02', | ||||||
|  |         learningPathLanguage: Language.English, | ||||||
|  |         groups: [], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [assignment01, assignment02, assignment03]; | ||||||
|  | } | ||||||
							
								
								
									
										36
									
								
								backend/tests/test_assets/assignments/groups.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								backend/tests/test_assets/assignments/groups.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Group } from '../../../src/entities/assignments/group.entity'; | ||||||
|  | import { Assignment } from '../../../src/entities/assignments/assignment.entity'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestGroups( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     students: Array<Student>, | ||||||
|  |     assignments: Array<Assignment> | ||||||
|  | ): Array<Group> { | ||||||
|  |     const group01 = em.create(Group, { | ||||||
|  |         assignment: assignments[0], | ||||||
|  |         groupNumber: 1, | ||||||
|  |         members: students.slice(0, 2), | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const group02 = em.create(Group, { | ||||||
|  |         assignment: assignments[0], | ||||||
|  |         groupNumber: 2, | ||||||
|  |         members: students.slice(2, 4), | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const group03 = em.create(Group, { | ||||||
|  |         assignment: assignments[0], | ||||||
|  |         groupNumber: 3, | ||||||
|  |         members: students.slice(4, 6), | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const group04 = em.create(Group, { | ||||||
|  |         assignment: assignments[1], | ||||||
|  |         groupNumber: 4, | ||||||
|  |         members: students.slice(3, 4), | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [group01, group02, group03, group04]; | ||||||
|  | } | ||||||
							
								
								
									
										71
									
								
								backend/tests/test_assets/assignments/submission.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								backend/tests/test_assets/assignments/submission.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,71 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Submission } from '../../../src/entities/assignments/submission.entity'; | ||||||
|  | import { Language } from '../../../src/entities/content/language'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | import { Group } from '../../../src/entities/assignments/group.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestSubmissions( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     students: Array<Student>, | ||||||
|  |     groups: Array<Group> | ||||||
|  | ): Array<Submission> { | ||||||
|  |     const submission01 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id03', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         submissionNumber: 1, | ||||||
|  |         submitter: students[0], | ||||||
|  |         submissionTime: new Date(2025, 2, 20), | ||||||
|  |         onBehalfOf: groups[0], | ||||||
|  |         content: 'sub1', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission02 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id03', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         submissionNumber: 2, | ||||||
|  |         submitter: students[0], | ||||||
|  |         submissionTime: new Date(2025, 2, 25), | ||||||
|  |         onBehalfOf: groups[0], | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission03 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id02', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         submissionNumber: 1, | ||||||
|  |         submitter: students[0], | ||||||
|  |         submissionTime: new Date(2025, 2, 20), | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission04 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id02', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         submissionNumber: 2, | ||||||
|  |         submitter: students[0], | ||||||
|  |         submissionTime: new Date(2025, 2, 25), | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission05 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id01', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         submissionNumber: 1, | ||||||
|  |         submitter: students[1], | ||||||
|  |         submissionTime: new Date(2025, 2, 20), | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [ | ||||||
|  |         submission01, | ||||||
|  |         submission02, | ||||||
|  |         submission03, | ||||||
|  |         submission04, | ||||||
|  |         submission05, | ||||||
|  |     ]; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,44 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { | ||||||
|  |     ClassJoinRequest, | ||||||
|  |     ClassJoinRequestStatus, | ||||||
|  | } from '../../../src/entities/classes/class-join-request.entity'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestClassJoinRequests( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     students: Array<Student>, | ||||||
|  |     classes: Array<Class> | ||||||
|  | ): Array<ClassJoinRequest> { | ||||||
|  |     const classJoinRequest01 = em.create(ClassJoinRequest, { | ||||||
|  |         requester: students[4], | ||||||
|  |         class: classes[1], | ||||||
|  |         status: ClassJoinRequestStatus.Open, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const classJoinRequest02 = em.create(ClassJoinRequest, { | ||||||
|  |         requester: students[2], | ||||||
|  |         class: classes[1], | ||||||
|  |         status: ClassJoinRequestStatus.Open, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const classJoinRequest03 = em.create(ClassJoinRequest, { | ||||||
|  |         requester: students[4], | ||||||
|  |         class: classes[2], | ||||||
|  |         status: ClassJoinRequestStatus.Open, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const classJoinRequest04 = em.create(ClassJoinRequest, { | ||||||
|  |         requester: students[3], | ||||||
|  |         class: classes[2], | ||||||
|  |         status: ClassJoinRequestStatus.Open, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [ | ||||||
|  |         classJoinRequest01, | ||||||
|  |         classJoinRequest02, | ||||||
|  |         classJoinRequest03, | ||||||
|  |         classJoinRequest04, | ||||||
|  |     ]; | ||||||
|  | } | ||||||
							
								
								
									
										54
									
								
								backend/tests/test_assets/classes/classes.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								backend/tests/test_assets/classes/classes.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestClasses( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     students: Array<Student>, | ||||||
|  |     teachers: Array<Teacher> | ||||||
|  | ): Array<Class> { | ||||||
|  |     const studentsClass01 = students.slice(0, 7); | ||||||
|  |     const teacherClass01: Array<Teacher> = teachers.slice(0, 1); | ||||||
|  | 
 | ||||||
|  |     const class01 = em.create(Class, { | ||||||
|  |         classId: 'id01', | ||||||
|  |         displayName: 'class01', | ||||||
|  |         teachers: teacherClass01, | ||||||
|  |         students: studentsClass01, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const studentsClass02: Array<Student> = students | ||||||
|  |         .slice(0, 2) | ||||||
|  |         .concat(students.slice(3, 4)); | ||||||
|  |     const teacherClass02: Array<Teacher> = teachers.slice(1, 2); | ||||||
|  | 
 | ||||||
|  |     const class02 = em.create(Class, { | ||||||
|  |         classId: 'id02', | ||||||
|  |         displayName: 'class02', | ||||||
|  |         teachers: teacherClass02, | ||||||
|  |         students: studentsClass02, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const studentsClass03: Array<Student> = students.slice(1, 4); | ||||||
|  |     const teacherClass03: Array<Teacher> = teachers.slice(2, 3); | ||||||
|  | 
 | ||||||
|  |     const class03 = em.create(Class, { | ||||||
|  |         classId: 'id03', | ||||||
|  |         displayName: 'class03', | ||||||
|  |         teachers: teacherClass03, | ||||||
|  |         students: studentsClass03, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const studentsClass04: Array<Student> = students.slice(0, 2); | ||||||
|  |     const teacherClass04: Array<Teacher> = teachers.slice(2, 3); | ||||||
|  | 
 | ||||||
|  |     const class04 = em.create(Class, { | ||||||
|  |         classId: 'id04', | ||||||
|  |         displayName: 'class04', | ||||||
|  |         teachers: teacherClass04, | ||||||
|  |         students: studentsClass04, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [class01, class02, class03, class04]; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,41 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { TeacherInvitation } from '../../../src/entities/classes/teacher-invitation.entity'; | ||||||
|  | import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestTeacherInvitations( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     teachers: Array<Teacher>, | ||||||
|  |     classes: Array<Class> | ||||||
|  | ): Array<TeacherInvitation> { | ||||||
|  |     const teacherInvitation01 = em.create(TeacherInvitation, { | ||||||
|  |         sender: teachers[1], | ||||||
|  |         receiver: teachers[0], | ||||||
|  |         class: classes[1], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const teacherInvitation02 = em.create(TeacherInvitation, { | ||||||
|  |         sender: teachers[1], | ||||||
|  |         receiver: teachers[2], | ||||||
|  |         class: classes[1], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const teacherInvitation03 = em.create(TeacherInvitation, { | ||||||
|  |         sender: teachers[2], | ||||||
|  |         receiver: teachers[0], | ||||||
|  |         class: classes[2], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const teacherInvitation04 = em.create(TeacherInvitation, { | ||||||
|  |         sender: teachers[0], | ||||||
|  |         receiver: teachers[1], | ||||||
|  |         class: classes[0], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [ | ||||||
|  |         teacherInvitation01, | ||||||
|  |         teacherInvitation02, | ||||||
|  |         teacherInvitation03, | ||||||
|  |         teacherInvitation04, | ||||||
|  |     ]; | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								backend/tests/test_assets/content/attachments.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								backend/tests/test_assets/content/attachments.testdata.ts
									
										
									
									
									
										Normal 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]; | ||||||
|  | } | ||||||
							
								
								
									
										149
									
								
								backend/tests/test_assets/content/learning-objects.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								backend/tests/test_assets/content/learning-objects.testdata.ts
									
										
									
									
									
										Normal 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, | ||||||
|  |     ]; | ||||||
|  | } | ||||||
							
								
								
									
										104
									
								
								backend/tests/test_assets/content/learning-paths.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								backend/tests/test_assets/content/learning-paths.testdata.ts
									
										
									
									
									
										Normal 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]; | ||||||
|  | } | ||||||
							
								
								
									
										36
									
								
								backend/tests/test_assets/questions/answers.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								backend/tests/test_assets/questions/answers.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Answer } from '../../../src/entities/questions/answer.entity'; | ||||||
|  | import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||||
|  | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestAnswers( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     teachers: Array<Teacher>, | ||||||
|  |     questions: Array<Question> | ||||||
|  | ): Array<Answer> { | ||||||
|  |     const answer01 = em.create(Answer, { | ||||||
|  |         author: teachers[0], | ||||||
|  |         toQuestion: questions[1], | ||||||
|  |         sequenceNumber: 1, | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'answer', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const answer02 = em.create(Answer, { | ||||||
|  |         author: teachers[0], | ||||||
|  |         toQuestion: questions[1], | ||||||
|  |         sequenceNumber: 2, | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'answer2', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const answer03 = em.create(Answer, { | ||||||
|  |         author: teachers[1], | ||||||
|  |         toQuestion: questions[3], | ||||||
|  |         sequenceNumber: 1, | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'answer3', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [answer01, answer02, answer03]; | ||||||
|  | } | ||||||
							
								
								
									
										51
									
								
								backend/tests/test_assets/questions/questions.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								backend/tests/test_assets/questions/questions.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
|  | import { Language } from '../../../src/entities/content/language'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestQuestions( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>>, | ||||||
|  |     students: Array<Student> | ||||||
|  | ): Array<Question> { | ||||||
|  |     const question01 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         learningObjectHruid: 'id05', | ||||||
|  |         sequenceNumber: 1, | ||||||
|  |         author: students[0], | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const question02 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         learningObjectHruid: 'id05', | ||||||
|  |         sequenceNumber: 2, | ||||||
|  |         author: students[2], | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const question03 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         learningObjectHruid: 'id04', | ||||||
|  |         sequenceNumber: 1, | ||||||
|  |         author: students[0], | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const question04 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: '1', | ||||||
|  |         learningObjectHruid: 'id01', | ||||||
|  |         sequenceNumber: 1, | ||||||
|  |         author: students[1], | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [question01, question02, question03, question04]; | ||||||
|  | } | ||||||
							
								
								
									
										59
									
								
								backend/tests/test_assets/users/students.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								backend/tests/test_assets/users/students.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,59 @@ | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | 
 | ||||||
|  | export function makeTestStudents( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>> | ||||||
|  | ): Array<Student> { | ||||||
|  |     const student01 = em.create(Student, { | ||||||
|  |         username: 'Noordkaap', | ||||||
|  |         firstName: 'Stijn', | ||||||
|  |         lastName: 'Meuris', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const student02 = em.create(Student, { | ||||||
|  |         username: 'DireStraits', | ||||||
|  |         firstName: 'Mark', | ||||||
|  |         lastName: 'Knopfler', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const student03 = em.create(Student, { | ||||||
|  |         username: 'Tool', | ||||||
|  |         firstName: 'Maynard', | ||||||
|  |         lastName: 'Keenan', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const student04 = em.create(Student, { | ||||||
|  |         username: 'SmashingPumpkins', | ||||||
|  |         firstName: 'Billy', | ||||||
|  |         lastName: 'Corgan', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const student05 = em.create(Student, { | ||||||
|  |         username: 'PinkFloyd', | ||||||
|  |         firstName: 'David', | ||||||
|  |         lastName: 'Gilmoure', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const student06 = em.create(Student, { | ||||||
|  |         username: 'TheDoors', | ||||||
|  |         firstName: 'Jim', | ||||||
|  |         lastName: 'Morisson', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     // do not use for any tests, gets deleted in a unit test
 | ||||||
|  |     const student07 = em.create(Student, { | ||||||
|  |         username: 'Nirvana', | ||||||
|  |         firstName: 'Kurt', | ||||||
|  |         lastName: 'Cobain', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [ | ||||||
|  |         student01, | ||||||
|  |         student02, | ||||||
|  |         student03, | ||||||
|  |         student04, | ||||||
|  |         student05, | ||||||
|  |         student06, | ||||||
|  |         student07, | ||||||
|  |     ]; | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								backend/tests/test_assets/users/teachers.testdata.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								backend/tests/test_assets/users/teachers.testdata.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||||
|  | import { Connection, EntityManager, IDatabaseDriver } from '@mikro-orm/core'; | ||||||
|  | 
 | ||||||
|  | export function makeTestTeachers( | ||||||
|  |     em: EntityManager<IDatabaseDriver<Connection>> | ||||||
|  | ): Array<Teacher> { | ||||||
|  |     const teacher01 = em.create(Teacher, { | ||||||
|  |         username: 'FooFighters', | ||||||
|  |         firstName: 'Dave', | ||||||
|  |         lastName: 'Grohl', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const teacher02 = em.create(Teacher, { | ||||||
|  |         username: 'LimpBizkit', | ||||||
|  |         firstName: 'Fred', | ||||||
|  |         lastName: 'Durst', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const teacher03 = em.create(Teacher, { | ||||||
|  |         username: 'Staind', | ||||||
|  |         firstName: 'Aaron', | ||||||
|  |         lastName: 'Lewis', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     // should not be used, gets deleted in a unit test
 | ||||||
|  |     const teacher04 = em.create(Teacher, { | ||||||
|  |         username: 'ZesdeMetaal', | ||||||
|  |         firstName: 'Wannes', | ||||||
|  |         lastName: 'Cappelle', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [teacher01, teacher02, teacher03, teacher04]; | ||||||
|  | } | ||||||
		Reference in a new issue
	
	 Laure Jablonski
						Laure Jablonski