test: extra testdate
This commit is contained in:
parent
c446e09aff
commit
d5031de537
2 changed files with 58 additions and 3 deletions
|
@ -2,6 +2,9 @@ import { EntityManager } from '@mikro-orm/core';
|
||||||
import { Answer } from '../../../src/entities/questions/answer.entity';
|
import { Answer } from '../../../src/entities/questions/answer.entity';
|
||||||
import { Teacher } from '../../../src/entities/users/teacher.entity';
|
import { Teacher } from '../../../src/entities/users/teacher.entity';
|
||||||
import { Question } from '../../../src/entities/questions/question.entity';
|
import { Question } from '../../../src/entities/questions/question.entity';
|
||||||
|
import { getTestleerling1 } from '../users/students.testdata';
|
||||||
|
import { getTestleerkracht1 } from '../users/teachers.testdata';
|
||||||
|
import { getQuestion07 } from './questions.testdata';
|
||||||
|
|
||||||
export function makeTestAnswers(em: EntityManager, teachers: Teacher[], questions: Question[]): Answer[] {
|
export function makeTestAnswers(em: EntityManager, teachers: Teacher[], questions: Question[]): Answer[] {
|
||||||
const answer01 = em.create(Answer, {
|
const answer01 = em.create(Answer, {
|
||||||
|
@ -28,5 +31,21 @@ export function makeTestAnswers(em: EntityManager, teachers: Teacher[], question
|
||||||
content: 'answer3',
|
content: 'answer3',
|
||||||
});
|
});
|
||||||
|
|
||||||
return [answer01, answer02, answer03];
|
const answer04 = em.create(Answer, {
|
||||||
|
author: getTestleerkracht1(),
|
||||||
|
toQuestion: getQuestion07(),
|
||||||
|
sequenceNumber: 1,
|
||||||
|
timestamp: new Date(),
|
||||||
|
content: "this is a test answer"
|
||||||
|
});
|
||||||
|
|
||||||
|
const answer05 = em.create(Answer, {
|
||||||
|
author: getTestleerkracht1(),
|
||||||
|
toQuestion: getQuestion07(),
|
||||||
|
sequenceNumber: 2,
|
||||||
|
timestamp: new Date(),
|
||||||
|
content: "this is a test answer"
|
||||||
|
});
|
||||||
|
|
||||||
|
return [answer01, answer02, answer03, answer04, answer05];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@ import { Question } from '../../../src/entities/questions/question.entity';
|
||||||
import { Language } from '@dwengo-1/common/util/language';
|
import { Language } from '@dwengo-1/common/util/language';
|
||||||
import { Student } from '../../../src/entities/users/student.entity';
|
import { Student } from '../../../src/entities/users/student.entity';
|
||||||
import { Group } from '../../../src/entities/assignments/group.entity';
|
import { Group } from '../../../src/entities/assignments/group.entity';
|
||||||
|
import { getTestleerling1 } from '../users/students.testdata';
|
||||||
|
import { testLearningObjectMultipleChoice } from '../content/learning-objects.testdata';
|
||||||
|
import { getGroup1ConditionalLearningPath } from '../assignments/groups.testdata';
|
||||||
|
|
||||||
export function makeTestQuestions(em: EntityManager, students: Student[], groups: Group[]): Question[] {
|
export function makeTestQuestions(em: EntityManager, students: Student[], groups: Group[]): Question[] {
|
||||||
const question01 = em.create(Question, {
|
const question01 = em.create(Question, {
|
||||||
|
@ -66,10 +69,43 @@ export function makeTestQuestions(em: EntityManager, students: Student[], groups
|
||||||
learningObjectHruid: 'id05',
|
learningObjectHruid: 'id05',
|
||||||
sequenceNumber: 4,
|
sequenceNumber: 4,
|
||||||
author: students[2],
|
author: students[2],
|
||||||
inGroup: groups[3], // Group #4 for Assignment #2 in class 'id02'
|
inGroup: groups[5], // Group #4 for Assignment #2 in class 'id02'
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
content: 'question',
|
content: 'question',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
question07 = em.create(Question, {
|
||||||
|
learningObjectLanguage: Language.English,
|
||||||
|
learningObjectVersion: 1,
|
||||||
|
learningObjectHruid: testLearningObjectMultipleChoice.hruid,
|
||||||
|
sequenceNumber: 1,
|
||||||
|
author: getTestleerling1(),
|
||||||
|
inGroup: getGroup1ConditionalLearningPath(),
|
||||||
|
timestamp: new Date(),
|
||||||
|
content: 'this is a test question',
|
||||||
|
});
|
||||||
|
|
||||||
return [question01, question02, question03, question04, question05, question06];
|
question08 = em.create(Question, {
|
||||||
|
learningObjectLanguage: Language.English,
|
||||||
|
learningObjectVersion: 1,
|
||||||
|
learningObjectHruid: testLearningObjectMultipleChoice.hruid,
|
||||||
|
sequenceNumber: 2,
|
||||||
|
author: getTestleerling1(),
|
||||||
|
inGroup: getGroup1ConditionalLearningPath(),
|
||||||
|
timestamp: new Date(),
|
||||||
|
content: 'this is a second test question'
|
||||||
|
});
|
||||||
|
|
||||||
|
return [question01, question02, question03, question04, question05, question06, question07, question08];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let question08: Question;
|
||||||
|
let question07: Question;
|
||||||
|
|
||||||
|
export function getQuestion07(): Question {
|
||||||
|
return question07;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQuestion08(): Question {
|
||||||
|
return question08;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue