test: de antwoorden die teruggegeven worden zijn de juiste
This commit is contained in:
		
							parent
							
								
									da8e27acfd
								
							
						
					
					
						commit
						946c233a52
					
				
					 2 changed files with 13 additions and 17 deletions
				
			
		|  | @ -28,38 +28,34 @@ describe('AnswerRepository', () => { | ||||||
|         const id = new LearningObjectIdentifier('id05', Language.English, '1'); |         const id = new LearningObjectIdentifier('id05', Language.English, '1'); | ||||||
|         const questions = |         const questions = | ||||||
|             await questionRepository.findAllQuestionsAboutLearningObject(id); |             await questionRepository.findAllQuestionsAboutLearningObject(id); | ||||||
|         let question: Question; | 
 | ||||||
|         if (questions[0].sequenceNumber == 2) { |         const question = questions.filter((it) => it.sequenceNumber == 2)[0]; | ||||||
|             question = questions[0]; | 
 | ||||||
|         } else { |  | ||||||
|             question = questions[1]; |  | ||||||
|         } |  | ||||||
|         const answers = |         const answers = | ||||||
|             await answerRepository.findAllAnswersToQuestion(question); |             await answerRepository.findAllAnswersToQuestion(question); | ||||||
| 
 | 
 | ||||||
|         expect(answers).toBeTruthy(); |         expect(answers).toBeTruthy(); | ||||||
|         expect(answers).toHaveLength(2); |         expect(answers).toHaveLength(2); | ||||||
|  |         expect(answers[0].content).toBeOneOf(['answer', 'answer2']); | ||||||
|  |         expect(answers[1].content).toBeOneOf(['answer', 'answer2']); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     // it('should create an answer to a question', async () => {
 |     // it('should create an answer to a question', async () => {
 | ||||||
|     //     const teacher = await TeacherRepository.findByUsername('FooFighters');
 |     //     const teacher = await teacherRepository.findByUsername('FooFighters');
 | ||||||
|     //     const id = new LearningObjectIdentifier('id05', Language.English, '1');
 |     //     const id = new LearningObjectIdentifier('id05', Language.English, '1');
 | ||||||
|     //     const questions =
 |     //     const questions =
 | ||||||
|     //         await QuestionRepository.findAllQuestionsAboutLearningObject(id);
 |     //         await questionRepository.findAllQuestionsAboutLearningObject(id);
 | ||||||
|     //     let question: Question;
 | 
 | ||||||
|     //     if (questions[0].sequenceNumber == 1) {
 |     //     const question = questions[0];
 | ||||||
|     //         question = questions[0];
 | 
 | ||||||
|     //     } else {
 |     //     await answerRepository.createAnswer({
 | ||||||
|     //         question = questions[1];
 |  | ||||||
|     //     }
 |  | ||||||
|     //     await AnswerRepository.createAnswer({
 |  | ||||||
|     //         toQuestion: question,
 |     //         toQuestion: question,
 | ||||||
|     //         author: teacher!,
 |     //         author: teacher!,
 | ||||||
|     //         content: 'created answer',
 |     //         content: 'created answer',
 | ||||||
|     //     });
 |     //     });
 | ||||||
| 
 | 
 | ||||||
|     //     const answers =
 |     //     const answers =
 | ||||||
|     //         await AnswerRepository.findAllAnswersToQuestion(question);
 |     //         await answerRepository.findAllAnswersToQuestion(question);
 | ||||||
| 
 | 
 | ||||||
|     //     expect(answers).toBeTruthy();
 |     //     expect(answers).toBeTruthy();
 | ||||||
|     //     expect(answers).toHaveLength(1);
 |     //     expect(answers).toHaveLength(1);
 | ||||||
|  |  | ||||||
|  | @ -537,7 +537,7 @@ export async function setupTestApp() { | ||||||
|         toQuestion: question04, |         toQuestion: question04, | ||||||
|         sequenceNumber: 1, |         sequenceNumber: 1, | ||||||
|         timestamp: new Date(), |         timestamp: new Date(), | ||||||
|         content: 'answer', |         content: 'answer3', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     const submission01 = em.create(Submission, { |     const submission01 = em.create(Submission, { | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Laure Jablonski
						Laure Jablonski