Skip to content

Commit

Permalink
COM-3719 - add seed Verifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Manon Palin committed Jun 18, 2024
1 parent a108938 commit d416f25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/integration/seed/questionnairesSeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ const questionnaireHistories = [
questionnaire: questionnairesList[3]._id,
user: traineeList[0]._id,
questionnaireAnswersList: [
{ card: cardsList[1]._id, answerList: ['test'] },
{ card: cardsList[3]._id, answerList: ['blabla2'] },
{ card: cardsList[1]._id, answerList: ['3'] },
{ card: cardsList[3]._id, answerList: ['4'] },
],
timeline: START_COURSE,
},
Expand Down
25 changes: 25 additions & 0 deletions tests/integration/seed/seedsVerification.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,31 @@ describe('SEEDS VERIFICATION', () => {

expect(everySelfPositionningHistoryHasTimeline).toBeTruthy();
});

it('should pass if every trainee\'s answer is authorized (SELF POSITIONNING QUESTIONNAIRE)', () => {
const everySelfPositionningHistoryHasAuthorizedTraineeAnswer = questionnaireHistoryList
.filter(qh => qh.questionnaire.type === SELF_POSITIONNING)
.every(qh => qh.questionnaireAnswersList.every(a => ['1', '2', '3', '4', '5'].includes(a.answerList[0])));

expect(everySelfPositionningHistoryHasAuthorizedTraineeAnswer).toBeTruthy();
});

it('should pass if every trainer\'s answer is authorized (SELF POSITIONNING QUESTIONNAIRE)', () => {
const everySelfPositionningHistoryHasAuthorizedTrainerAnswer = questionnaireHistoryList
.filter(qh => qh.questionnaire.type === SELF_POSITIONNING)
.every(qh => qh.questionnaireAnswersList
.every(a => !a.trainerAnswerList || ['1', '2', '3', '4', '5'].includes(a.trainerAnswerList[0])));

expect(everySelfPositionningHistoryHasAuthorizedTrainerAnswer).toBeTruthy();
});

it('should pass if validated histories are linked to end self-positioning questionnaire', () => {
const everySelfPositionningHistoryHasAuthorizedTrainerAnswer = questionnaireHistoryList
.filter(qh => qh.isValidated)
.every(qh => qh.questionnaire.type === SELF_POSITIONNING && qh.timeline === END_COURSE);

expect(everySelfPositionningHistoryHasAuthorizedTrainerAnswer).toBeTruthy();
});
});

describe('Collection SectorHistory', () => {
Expand Down

0 comments on commit d416f25

Please sign in to comment.