Skip to content

Commit

Permalink
feat(api): add validation indicators on pix junior challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelie-crouillebois committed Jan 31, 2025
1 parent 13919b7 commit 080f4a7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const serialize = function (challenges) {
'focused',
'timer',
'shuffled',
'hasEmbedInternalValidation',
'noValidationNeeded',
],
transform: (challenge) => {
return {
Expand Down
4 changes: 4 additions & 0 deletions api/src/shared/domain/models/Challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class Challenge {
alternativeVersion,
blindnessCompatibility,
colorBlindnessCompatibility,
hasEmbedInternalValidation,
noValidationNeeded,
} = {}) {
this.id = id;
this.answer = answer;
Expand Down Expand Up @@ -121,6 +123,8 @@ class Challenge {
this.alternativeVersion = alternativeVersion;
this.blindnessCompatibility = blindnessCompatibility;
this.colorBlindnessCompatibility = colorBlindnessCompatibility;
this.hasEmbedInternalValidation = hasEmbedInternalValidation;
this.noValidationNeeded = noValidationNeeded;
}

isTimed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ function toDomain({ challengeDto, webComponentTagName, webComponentProps, skill,
blindnessCompatibility: challengeDto.accessibility1,
colorBlindnessCompatibility: challengeDto.accessibility2,
successProbabilityThreshold,
hasEmbedInternalValidation: challengeDto.hasEmbedInternalValidation,
noValidationNeeded: challengeDto.noValidationNeeded,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ describe('Unit | Serializer | challenge-serializer', function () {
focused: false,
illustrationAlt: 'alt',
autoReply: false,
hasEmbedInternalValidation: true,
noValidationNeeded: true,
});

// when
Expand Down Expand Up @@ -58,6 +60,8 @@ describe('Unit | Serializer | challenge-serializer', function () {
timer: 300,
'illustration-alt': 'alt',
'auto-reply': false,
'has-embed-internal-validation': true,
'no-validation-needed': true,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ describe('Integration | Repository | challenge-repository', function () {
locales: ['fr', 'nl'],
competenceId: 'competenceId00',
skillId: 'skillId00',
hasEmbedInternalValidation: true,
noValidationNeeded: true,
};
const challengeData01_skill00_qcu_valide_flashCompatible_fren_withEmbedJson = {
id: 'challengeId01',
Expand Down Expand Up @@ -83,6 +85,8 @@ describe('Integration | Repository | challenge-repository', function () {
locales: ['fr', 'en'],
competenceId: 'competenceId00',
skillId: 'skillId00',
hasEmbedInternalValidation: true,
noValidationNeeded: true,
};
const challengeData02_skill00_qcm_archive_flashCompatible_en_noEmbedJson = {
id: 'challengeId02',
Expand Down Expand Up @@ -530,6 +534,8 @@ describe('Integration | Repository | challenge-repository', function () {
}),
webComponentTagName: 'web-component',
webComponentProps: { prop1: 'value1', prop2: 'value2' },
hasEmbedInternalValidation: true,
noValidationNeeded: true,
}),
);
});
Expand Down Expand Up @@ -583,6 +589,8 @@ describe('Integration | Repository | challenge-repository', function () {
difficulty: skillData00_tube00competence00_actif.level,
hint: skillData00_tube00competence00_actif.hint_i18n.fr,
}),
hasEmbedInternalValidation: true,
noValidationNeeded: true,
}),
);
});
Expand Down
8 changes: 8 additions & 0 deletions api/tests/tooling/domain-builder/factory/build-challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const buildChallenge = function ({
competenceId = 'recCOMP1',
webComponentTagName,
webComponentProps,
hasEmbedInternalValidation = false,
noValidationNeeded = false,
} = {}) {
return new Challenge({
id,
Expand Down Expand Up @@ -73,6 +75,8 @@ const buildChallenge = function ({
skill,
// references
competenceId,
hasEmbedInternalValidation,
noValidationNeeded,
});
};

Expand Down Expand Up @@ -109,6 +113,8 @@ const buildChallengeWithWebComponent = function ({
skill = buildSkill(),
// references
competenceId = 'recCOMP1',
hasEmbedInternalValidation,
noValidationNeeded,
} = {}) {
return new Challenge({
id,
Expand Down Expand Up @@ -143,6 +149,8 @@ const buildChallengeWithWebComponent = function ({
skill,
// references
competenceId,
hasEmbedInternalValidation,
noValidationNeeded,
});
};

Expand Down

0 comments on commit 080f4a7

Please sign in to comment.