diff --git a/api/src/devcomp/infrastructure/serializers/jsonapi/tutorial-serializer.js b/api/src/devcomp/infrastructure/serializers/jsonapi/tutorial-serializer.js index 3995e45b413..c6d7283feec 100644 --- a/api/src/devcomp/infrastructure/serializers/jsonapi/tutorial-serializer.js +++ b/api/src/devcomp/infrastructure/serializers/jsonapi/tutorial-serializer.js @@ -24,6 +24,7 @@ const serialize = function (tutorial = {}, pagination) { userSavedTutorial: userSavedTutorialAttributes, typeForAttribute(attribute) { if (attribute === 'userSavedTutorial') return 'user-saved-tutorial'; + if (attribute === 'tutorialEvaluation') return 'tutorial-evaluation'; return attribute; }, meta: pagination, diff --git a/api/tests/devcomp/unit/infrastructure/serializers/jsonapi/tutorial-serializer_test.js b/api/tests/devcomp/unit/infrastructure/serializers/jsonapi/tutorial-serializer_test.js index 409ee18950e..bbfc03bf911 100644 --- a/api/tests/devcomp/unit/infrastructure/serializers/jsonapi/tutorial-serializer_test.js +++ b/api/tests/devcomp/unit/infrastructure/serializers/jsonapi/tutorial-serializer_test.js @@ -113,7 +113,7 @@ describe('Unit | Serializer | JSONAPI | tutorial-serializer', function () { 'tutorial-evaluation': { data: { id: tutorialEvaluationId, - type: 'tutorialEvaluation', + type: 'tutorial-evaluation', }, }, 'user-saved-tutorial': { @@ -132,7 +132,7 @@ describe('Unit | Serializer | JSONAPI | tutorial-serializer', function () { 'tutorial-id': tutorialId, }, id: tutorialEvaluationId, - type: 'tutorialEvaluation', + type: 'tutorial-evaluation', }, { attributes: { diff --git a/mon-pix/app/app.js b/mon-pix/app/app.js index a7e33de6898..2c257b4311b 100644 --- a/mon-pix/app/app.js +++ b/mon-pix/app/app.js @@ -1,3 +1,5 @@ +import './deprecation-workflow'; + import Application from '@ember/application'; import { init as initSentry } from '@sentry/ember'; import loadInitializers from 'ember-load-initializers'; diff --git a/mon-pix/app/components/campaigns/assessment/results/evaluation-results-tabs/rewards/index.gjs b/mon-pix/app/components/campaigns/assessment/results/evaluation-results-tabs/rewards/index.gjs index 0966ad759bb..9123875fa56 100644 --- a/mon-pix/app/components/campaigns/assessment/results/evaluation-results-tabs/rewards/index.gjs +++ b/mon-pix/app/components/campaigns/assessment/results/evaluation-results-tabs/rewards/index.gjs @@ -21,7 +21,7 @@ export default class Rewards extends Component { getFilteredAndSortedBadges(acquisitionStatus) { return this.args.badges - .toArray() + .slice() .filter(({ isAcquired }) => isAcquired === acquisitionStatus) .sort((a, b) => b.isCertifiable - a.isCertifiable); } diff --git a/mon-pix/app/templates/components/focused-certification-challenge-instructions.hbs b/mon-pix/app/components/focused-certification-challenge-instructions.hbs similarity index 100% rename from mon-pix/app/templates/components/focused-certification-challenge-instructions.hbs rename to mon-pix/app/components/focused-certification-challenge-instructions.hbs diff --git a/mon-pix/app/components/pix-toggle-deprecated.gjs b/mon-pix/app/components/pix-toggle-deprecated.gjs new file mode 100644 index 00000000000..34dc843af24 --- /dev/null +++ b/mon-pix/app/components/pix-toggle-deprecated.gjs @@ -0,0 +1,37 @@ +import { on } from '@ember/modifier'; +import { action } from '@ember/object'; +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; + +export default class PixToggleDeprecated extends Component { + @tracked isFirstOn = true; + + get firstButtonClass() { + return this.isFirstOn ? 'pix-toggle-deprecated__on' : 'pix-toggle-deprecated__off'; + } + + get secondButtonClass() { + return this.isFirstOn ? 'pix-toggle-deprecated__off' : 'pix-toggle-deprecated__on'; + } + + @action click() { + this.isFirstOn = !this.isFirstOn; + if (this.args.onToggle && typeof this.args.onToggle === 'function') { + this.args.onToggle(this.isFirstOn); + } + } + + +} diff --git a/mon-pix/app/components/pix-toggle-deprecated.hbs b/mon-pix/app/components/pix-toggle-deprecated.hbs deleted file mode 100644 index 2fb0d604002..00000000000 --- a/mon-pix/app/components/pix-toggle-deprecated.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{! template-lint-disable no-action no-curly-component-invocation no-invalid-interactive }} -
- {{this.valueFirstLabel}} - {{this.valueSecondLabel}} -
-{{yield}} \ No newline at end of file diff --git a/mon-pix/app/components/pix-toggle-deprecated.js b/mon-pix/app/components/pix-toggle-deprecated.js deleted file mode 100644 index 588f57a471e..00000000000 --- a/mon-pix/app/components/pix-toggle-deprecated.js +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint ember/no-actions-hash: 0 */ -/* eslint ember/no-classic-classes: 0 */ -/* eslint ember/no-classic-components: 0 */ -/* eslint ember/require-tagless-components: 0 */ - -import Component from '@ember/component'; -import { computed } from '@ember/object'; - -export default Component.extend({ - valueFirstLabel: '', - valueSecondLabel: '', - isFirstOn: true, - - firstButtonClass: computed('isFirstOn', function () { - return this.isFirstOn ? 'pix-toggle-deprecated__on' : 'pix-toggle-deprecated__off'; - }), - - secondButtonClass: computed('isFirstOn', function () { - return this.isFirstOn ? 'pix-toggle-deprecated__off' : 'pix-toggle-deprecated__on'; - }), - - click: function (e) { - if (e.target.className === 'pix-toggle-deprecated__off') { - this.toggleProperty('isFirstOn'); - } - - this.onToggle(this.isFirstOn); - }, - - actions: { - onToggle: () => {}, - }, -}); diff --git a/mon-pix/app/components/tutorials/card.js b/mon-pix/app/components/tutorials/card.js index ec7cfc066a6..3c0946ad079 100644 --- a/mon-pix/app/components/tutorials/card.js +++ b/mon-pix/app/components/tutorials/card.js @@ -67,7 +67,7 @@ export default class Card extends Component { async _saveTutorial() { try { - const userSavedTutorial = this.store.createRecord('userSavedTutorial', { tutorial: this.args.tutorial }); + const userSavedTutorial = this.store.createRecord('user-saved-tutorial', { tutorial: this.args.tutorial }); await userSavedTutorial.save(); this.savingStatus = buttonStatusTypes.recorded; } catch { @@ -89,7 +89,7 @@ export default class Card extends Component { async evaluateTutorial() { const tutorial = this.args.tutorial; const tutorialEvaluation = - tutorial.tutorialEvaluation ?? this.store.createRecord('tutorialEvaluation', { tutorial: tutorial }); + tutorial.tutorialEvaluation ?? this.store.createRecord('tutorial-evaluation', { tutorial: tutorial }); try { await tutorialEvaluation.save({ adapterOptions: { tutorialId: tutorial.id, status: tutorialEvaluation.nextStatus }, diff --git a/mon-pix/app/deprecation-workflow.js b/mon-pix/app/deprecation-workflow.js new file mode 100644 index 00000000000..7e793b0fd30 --- /dev/null +++ b/mon-pix/app/deprecation-workflow.js @@ -0,0 +1,3 @@ +import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow'; + +setupDeprecationWorkflow(); diff --git a/mon-pix/app/models/certification.js b/mon-pix/app/models/certification.js index a9a73be210c..aa3815c5e0e 100644 --- a/mon-pix/app/models/certification.js +++ b/mon-pix/app/models/certification.js @@ -29,7 +29,7 @@ export default class Certification extends Model { @attr('number') version; // includes - @belongsTo('resultCompetenceTree', { async: true, inverse: null }) resultCompetenceTree; + @belongsTo('result-competence-tree', { async: true, inverse: null }) resultCompetenceTree; @belongsTo('user', { async: true, inverse: 'certifications' }) user; @computed('certifiedBadgeImages.length') diff --git a/mon-pix/app/models/profile.js b/mon-pix/app/models/profile.js index d6599430798..56af57c6cce 100644 --- a/mon-pix/app/models/profile.js +++ b/mon-pix/app/models/profile.js @@ -1,13 +1,15 @@ import Model, { attr, hasMany } from '@ember-data/model'; - +import uniqBy from 'lodash/uniqBy'; export default class Profile extends Model { @attr('number') pixScore; @attr('number') maxReachablePixScore; @attr('number') maxReachableLevel; @hasMany('scorecard', { async: false, inverse: null }) scorecards; - get areas() { - return this.scorecards.map((s) => s.area).uniqBy('code'); + return uniqBy( + this.scorecards.slice().map((s) => s.area), + 'code', + ); } } diff --git a/mon-pix/app/models/shared-profile-for-campaign.js b/mon-pix/app/models/shared-profile-for-campaign.js index 67607f654fd..9616a326d5b 100644 --- a/mon-pix/app/models/shared-profile-for-campaign.js +++ b/mon-pix/app/models/shared-profile-for-campaign.js @@ -13,7 +13,7 @@ export default class SharedProfileForCampaign extends Model { get areas() { return uniqBy( - this.scorecards.map((s) => s.area), + this.scorecards.slice().map((s) => s.area), 'code', ); } diff --git a/mon-pix/app/routes/assessments/challenge.js b/mon-pix/app/routes/assessments/challenge.js index e162e2ffad7..fd572bd980d 100644 --- a/mon-pix/app/routes/assessments/challenge.js +++ b/mon-pix/app/routes/assessments/challenge.js @@ -47,7 +47,7 @@ export default class ChallengeRoute extends Route { answer: this.store.queryRecord('answer', { assessmentId: assessment.id, challengeId: challenge.id }), currentChallengeNumber, }).catch((err) => { - const meta = 'errors' in err ? err.errors.get('firstObject').meta : null; + const meta = 'errors' in err ? err.errors[0].meta : null; if (meta.field === 'authorization') { this.router.transitionTo('authenticated'); return; diff --git a/mon-pix/app/routes/authenticated/competences/results.js b/mon-pix/app/routes/authenticated/competences/results.js index c2e4119f3da..31c7803823d 100644 --- a/mon-pix/app/routes/authenticated/competences/results.js +++ b/mon-pix/app/routes/authenticated/competences/results.js @@ -8,7 +8,7 @@ export default class ResultsRoute extends Route { async model(params) { const assessmentId = params.assessment_id; - const competenceEvaluations = await this.store.findAll('competenceEvaluation', { + const competenceEvaluations = await this.store.findAll('competence-evaluation', { reload: true, adapterOptions: { assessmentId }, }); diff --git a/mon-pix/app/routes/authenticated/competences/resume.js b/mon-pix/app/routes/authenticated/competences/resume.js index 791e2085f8e..1cb7dc6f305 100644 --- a/mon-pix/app/routes/authenticated/competences/resume.js +++ b/mon-pix/app/routes/authenticated/competences/resume.js @@ -9,7 +9,7 @@ export default class ResumeRoute extends Route { model(params, transition) { const competenceId = transition.to.parent.params.competence_id; - return this.store.queryRecord('competenceEvaluation', { competenceId, startOrResume: true }); + return this.store.queryRecord('competence-evaluation', { competenceId, startOrResume: true }); } async redirect(competenceEvaluation) { diff --git a/mon-pix/app/routes/campaigns/profiles-collection/profile-already-shared.js b/mon-pix/app/routes/campaigns/profiles-collection/profile-already-shared.js index 029691b85b2..5d28907dac5 100644 --- a/mon-pix/app/routes/campaigns/profiles-collection/profile-already-shared.js +++ b/mon-pix/app/routes/campaigns/profiles-collection/profile-already-shared.js @@ -15,7 +15,7 @@ export default class ProfileAlreadySharedRoute extends Route { const user = this.currentUser.user; const campaign = this.modelFor('campaigns'); try { - const sharedProfile = await this.store.queryRecord('sharedProfileForCampaign', { + const sharedProfile = await this.store.queryRecord('shared-profile-for-campaign', { campaignId: campaign.id, userId: user.id, }); diff --git a/mon-pix/config/deprecation-workflow.js b/mon-pix/config/deprecation-workflow.js deleted file mode 100644 index 03399839b6d..00000000000 --- a/mon-pix/config/deprecation-workflow.js +++ /dev/null @@ -1,11 +0,0 @@ -self.deprecationWorkflow = self.deprecationWorkflow || {}; - -self.deprecationWorkflow.config = { - workflow: [ - { handler: 'silence', matchId: 'ember-polyfills.deprecate-assign' }, - { handler: 'silence', matchId: 'deprecate-ember-error' }, - { handler: 'silence', matchId: 'ember-data:deprecate-promise-many-array-behaviors' }, - { handler: 'silence', matchId: 'ember-data:deprecate-store-find' }, - { handler: 'silence', matchId: 'ember-data:deprecate-array-like' }, - ], -}; diff --git a/mon-pix/config/ember-cli-update.json b/mon-pix/config/ember-cli-update.json new file mode 100644 index 00000000000..ed21e62a3dd --- /dev/null +++ b/mon-pix/config/ember-cli-update.json @@ -0,0 +1,20 @@ +{ + "schemaVersion": "1.0.0", + "packages": [ + { + "name": "ember-cli", + "version": "5.12.0", + "blueprints": [ + { + "name": "app", + "outputRepo": "https://github.com/ember-cli/ember-new-output", + "codemodsSource": "ember-app-codemods-manifest@1", + "isBaseBlueprint": true, + "options": [ + "--no-welcome" + ] + } + ] + } + ] +} diff --git a/mon-pix/config/environment.js b/mon-pix/config/environment.js index 3e32fe7ebff..44ff99ec7b6 100644 --- a/mon-pix/config/environment.js +++ b/mon-pix/config/environment.js @@ -29,13 +29,6 @@ module.exports = function (environment) { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true }, - EXTEND_PROTOTYPES: { - // Prevent Ember Data from overriding Date.parse. - Date: false, - Function: false, - String: false, - Array: true, - }, }, APP: { diff --git a/mon-pix/mirage/factories/assessment.js b/mon-pix/mirage/factories/assessment.js index e2000a1b00d..50656b9dcb3 100644 --- a/mon-pix/mirage/factories/assessment.js +++ b/mon-pix/mirage/factories/assessment.js @@ -21,7 +21,7 @@ export default Factory.extend({ type: 'COMPETENCE_EVALUATION', afterCreate(assessment, server) { assessment.update({ - progression: server.create('progression', { id: 3, completionRate: 20 }), + progression: server.create('progression', { id: '3', completionRate: 20 }), }); }, }), diff --git a/mon-pix/mirage/routes/answers/get-answer-by-challenge-and-assessment.js b/mon-pix/mirage/routes/answers/get-answer-by-challenge-and-assessment.js index 4c372721b30..9f33b9c3f5f 100644 --- a/mon-pix/mirage/routes/answers/get-answer-by-challenge-and-assessment.js +++ b/mon-pix/mirage/routes/answers/get-answer-by-challenge-and-assessment.js @@ -5,7 +5,7 @@ export default function (schema, request) { const answers = schema.answers.where({ assessmentId, challengeId }); if (answers.models.length !== 0) { - return answers.models.get('firstObject'); + return answers.models[0]; } return { data: null }; diff --git a/mon-pix/mirage/routes/get-feature-toggles.js b/mon-pix/mirage/routes/get-feature-toggles.js index ef93a1a6580..09f6acb170c 100644 --- a/mon-pix/mirage/routes/get-feature-toggles.js +++ b/mon-pix/mirage/routes/get-feature-toggles.js @@ -1,3 +1,3 @@ export default function (schema) { - return schema.featureToggles.findOrCreateBy({ id: 0 }); + return schema.featureToggles.findOrCreateBy({ id: '0' }); } diff --git a/mon-pix/mirage/routes/post-session-participation.js b/mon-pix/mirage/routes/post-session-participation.js index 5370d493e66..c8488fb9c43 100644 --- a/mon-pix/mirage/routes/post-session-participation.js +++ b/mon-pix/mirage/routes/post-session-participation.js @@ -34,7 +34,7 @@ export default function (schema, request) { } return schema.certificationCandidates.create({ - id: 2, + id: '2', firstName: 'Laura', lastName: 'Bravo', sessionId: 1, diff --git a/mon-pix/mirage/routes/put-tutorial-evaluation.js b/mon-pix/mirage/routes/put-tutorial-evaluation.js index ae44f3e3439..97aaa4b06a4 100644 --- a/mon-pix/mirage/routes/put-tutorial-evaluation.js +++ b/mon-pix/mirage/routes/put-tutorial-evaluation.js @@ -18,7 +18,7 @@ export default function (schema, request) { } if (!tutorialEvaluation) { - return schema.tutorialEvaluations.create({ id: 1, tutorialId, tutorial, status }); + return schema.tutorialEvaluations.create({ id: '1', tutorialId, tutorial, status }); } - return schema.tutorialEvaluations.update({ id: 1, tutorialId, tutorial, status }); + return schema.tutorialEvaluations.update({ id: '1', tutorialId, tutorial, status }); } diff --git a/mon-pix/mirage/routes/put-user-saved-tutorial.js b/mon-pix/mirage/routes/put-user-saved-tutorial.js index f09c8b832d4..7da0763b5d3 100644 --- a/mon-pix/mirage/routes/put-user-saved-tutorial.js +++ b/mon-pix/mirage/routes/put-user-saved-tutorial.js @@ -14,5 +14,5 @@ export default function (schema, request) { return new Response(404); } - return schema.userSavedTutorials.create({ id: 1 }); + return schema.userSavedTutorials.create({ id: '1' }); } diff --git a/mon-pix/mirage/routes/sco-organization-learners/index.js b/mon-pix/mirage/routes/sco-organization-learners/index.js index 5f3429248f3..f98e1609c90 100644 --- a/mon-pix/mirage/routes/sco-organization-learners/index.js +++ b/mon-pix/mirage/routes/sco-organization-learners/index.js @@ -86,7 +86,7 @@ export default function index(config) { { data: { type: 'student-information', - id: 3, + id: '3', attributes: { 'first-name': foundUser.firstName, 'last-name': foundUser.lastName, diff --git a/mon-pix/mirage/routes/users/index.js b/mon-pix/mirage/routes/users/index.js index 2f00ff8fd54..e3e4d5638c4 100644 --- a/mon-pix/mirage/routes/users/index.js +++ b/mon-pix/mirage/routes/users/index.js @@ -30,7 +30,7 @@ export default function index(config) { const locale = params.data.attributes['locale']; const cgu = params.data.attributes['cgu']; - return schema.users.create({ id: 10000, firstName, lastName, email, password, cgu, locale }); + return schema.users.create({ id: '10000', firstName, lastName, email, password, cgu, locale }); }); config.post('/users/:id/competences/:competenceId/reset', resetScorecard); diff --git a/mon-pix/package-lock.json b/mon-pix/package-lock.json index 359ddcf410d..9e2bebbf9b1 100644 --- a/mon-pix/package-lock.json +++ b/mon-pix/package-lock.json @@ -16,11 +16,11 @@ "@1024pix/eslint-plugin": "^2.0.4", "@1024pix/pix-ui": "^52.3.5", "@1024pix/stylelint-config": "^5.1.27", - "@babel/eslint-parser": "^7.19.1", - "@babel/plugin-proposal-decorators": "^7.20.2", + "@babel/eslint-parser": "^7.25.1", + "@babel/plugin-proposal-decorators": "^7.24.7", "@ember-data/json-api": "^5.3.8", "@ember-data/model": "^5.3.8", - "@ember/optional-features": "^2.0.0", + "@ember/optional-features": "^2.1.0", "@ember/string": "^3.1.1", "@ember/test-helpers": "^4.0.0", "@embroider/compat": "^3.0.0", @@ -35,14 +35,14 @@ "buffer": "^6.0.3", "dayjs": "^1.11.6", "dotenv": "^16.0.3", - "ember-auto-import": "^2.4.3", + "ember-auto-import": "^2.8.1", "ember-cli": "^6.0.0", "ember-cli-app-version": "^7.0.0", "ember-cli-autoprefixer": "^2.0.0", "ember-cli-babel": "^8.0.0", "ember-cli-clipboard": "^1.0.0", "ember-cli-dependency-checker": "^3.3.1", - "ember-cli-deprecation-workflow": "^3.0.0", + "ember-cli-deprecation-workflow": "^3.1.0", "ember-cli-htmlbars": "^6.1.1", "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-mirage": "^3.0.3", @@ -64,7 +64,7 @@ "ember-resolver": "^13.0.0", "ember-responsive": "^5.0.0", "ember-simple-auth": "^7.0.0", - "ember-source": "^5.9.0", + "ember-source": "^6.0.0", "ember-template-imports": "^4.1.1", "ember-template-lint": "^6.0.0", "ember-template-lint-plugin-prettier": "^5.0.0", @@ -72,7 +72,7 @@ "ember-truth-helpers": "^4.0.0", "eslint": "^9.17.0", "eslint-config-prettier": "^9.0.0", - "eslint-plugin-ember": "^12.0.0", + "eslint-plugin-ember": "^12.2.1", "eslint-plugin-i18n-json": "^4.0.0", "eslint-plugin-n": "^17.0.0", "eslint-plugin-prettier": "^5.0.0", @@ -89,13 +89,13 @@ "prettier": "^3.0.0", "prettier-plugin-ember-template-tag": "^2.0.2", "qunit": "^2.19.1", - "qunit-dom": "^3.0.0", + "qunit-dom": "^3.2.1", "sass": "^1.56.0", "showdown": "^2.1.0", "sinon": "^19.0.0", "stylelint": "^16.0.0", "stylelint-order": "^6.0.0", - "webpack": "^5.76.0", + "webpack": "^5.95.0", "xss": "^1.0.13" }, "engines": { @@ -1825,9 +1825,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.25.9.tgz", - "integrity": "sha512-5UXfgpK0j0Xr/xIdgdLEhOFxaDZ0bRPWJJchRpqOSur/3rZoPbqqki5mm0p4NE2cs28krBEiSM2MB7//afRSQQ==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.25.1.tgz", + "integrity": "sha512-Y956ghgTT4j7rKesabkh5WeqgSFZVFwaPR0IWFm7KFHFmmJ4afbG49SmfW4S+GyRPx0Dy5jxEWA5t0rpxfElWg==", "dev": true, "license": "MIT", "dependencies": { @@ -2272,15 +2272,15 @@ } }, "node_modules/@babel/plugin-proposal-decorators": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.25.9.tgz", - "integrity": "sha512-smkNLL/O1ezy9Nhy4CNosc4Va+1wo5w4gzSZeLe6y6dM4mmHfYOCPolXQPHQxonZCF+ZyebxN9vqOolkYrSn5g==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.24.7.tgz", + "integrity": "sha512-RL9GR0pUG5Kc8BUWLNDm2T5OpYwSX15r98I0IkgmRQTXuELq/OynH8xtMTMvTJFjXbMWFVTKtYkTaYQsuAwQlQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.25.9", - "@babel/helper-plugin-utils": "^7.25.9", - "@babel/plugin-syntax-decorators": "^7.25.9" + "@babel/helper-create-class-features-plugin": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-decorators": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -3895,9 +3895,9 @@ "license": "MIT" }, "node_modules/@ember/optional-features": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ember/optional-features/-/optional-features-2.2.0.tgz", - "integrity": "sha512-a1OQ+w9vDvMXd9BNA9r779yr8MAPguGaMGbIeTMPWACeWBdD6bACBB5iKE3gNyrJAYKMq2wab6BKmRFS3Qw3hw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@ember/optional-features/-/optional-features-2.1.0.tgz", + "integrity": "sha512-IXjDpTFhsjPk9h3OXwXjlRfhM/Wjtw2E71Xos/81ZsTTwZMB9H+DWhsxePXOkzYy7Jvw4TIzKbMfcnT8mrtwWQ==", "dev": true, "license": "MIT", "dependencies": { @@ -10516,17 +10516,6 @@ "@types/json-schema": "*" } }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -11039,6 +11028,16 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^8" + } + }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -17794,9 +17793,9 @@ } }, "node_modules/ember-auto-import": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/ember-auto-import/-/ember-auto-import-2.10.0.tgz", - "integrity": "sha512-bcBFDYVTFHyqyq8BNvsj6UO3pE6Uqou/cNmee0WaqBgZ+1nQqFz0UE26usrtnFAT+YaFZSkqF2H36QW84k0/cg==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/ember-auto-import/-/ember-auto-import-2.8.1.tgz", + "integrity": "sha512-R5RpJmhycU6YKryzsIL/wP42r0e2PPfLRsFECoGvb1st2eEnU1Q7XyLVC1txd/XvURfu7x3Z7hKtZtYUxy61oQ==", "dev": true, "license": "MIT", "dependencies": { @@ -19652,9 +19651,9 @@ } }, "node_modules/ember-cli-deprecation-workflow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/ember-cli-deprecation-workflow/-/ember-cli-deprecation-workflow-3.0.2.tgz", - "integrity": "sha512-Wjw4nNn1GMKLjKo/CrdFNaYSEW3qOuJYnBh7l8uO84EyWOYYvOLp9Ef4kGwaeehRgK8qDNcdzTFdPO6TD/aFIg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ember-cli-deprecation-workflow/-/ember-cli-deprecation-workflow-3.1.0.tgz", + "integrity": "sha512-tbN5YbEcyFEnOXN5J/TtTNAe2Qcr6bQQZgzHSLoPykiKsQ3Quq+P6BHKGzDEBK9G6YVIHFMWMmprENj+IXQTLQ==", "dev": true, "license": "MIT", "dependencies": { @@ -28274,9 +28273,9 @@ } }, "node_modules/ember-source": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/ember-source/-/ember-source-5.12.0.tgz", - "integrity": "sha512-2MWlJmQEeeiIk9p5CDMuvD470YPi7/4wXgU41ftbWc9svwF+0usoe4PLoLC0T/jV6YX+3SY5tumQfxLSLoFhmQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ember-source/-/ember-source-6.0.0.tgz", + "integrity": "sha512-3aBkhm8bXgwI1ONUgMF8wfKRF8opHrp31T9118B17qg6Fcpe6iiOJUwgyQbDX82cpq8jmbWFu8WPLOHDwqVysA==", "dev": true, "license": "MIT", "dependencies": { @@ -29966,15 +29965,15 @@ "license": "ISC" }, "node_modules/eslint-plugin-ember": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-ember/-/eslint-plugin-ember-12.3.2.tgz", - "integrity": "sha512-Hwrp66lzG6fsatHXgaoc6bqx3tZ01W97vSNPNL+B6VhsIc4ujg2M3QRsM1CYX1o38H5ET6UGqZNqvEmFmKNNig==", + "version": "12.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-ember/-/eslint-plugin-ember-12.2.1.tgz", + "integrity": "sha512-HZZueTKXmQRDVxREiMLdh87sLFmmkjH3z37gsS0pLWtnZECJiG447GCd+odVgWpSKoDpB4Hce0BtoJeY2HGSlg==", "dev": true, "license": "MIT", "dependencies": { "@ember-data/rfc395-data": "^0.0.4", "css-tree": "^2.3.1", - "ember-eslint-parser": "^0.5.4", + "ember-eslint-parser": "^0.5.2", "ember-rfc176-data": "^0.3.18", "eslint-utils": "^3.0.0", "estraverse": "^5.3.0", @@ -44403,9 +44402,9 @@ } }, "node_modules/qunit-dom": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/qunit-dom/-/qunit-dom-3.3.0.tgz", - "integrity": "sha512-sGPhNbZ/3gPbH3rp7PxnzqXuh6cyN/AG/vO/X9k0IYlsoBLi83MU6PdtSw/KiWLV8X/32jxD6fbeP9vjNAY4Dw==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/qunit-dom/-/qunit-dom-3.2.1.tgz", + "integrity": "sha512-+qSm8zQ7hPA9NijmTDVsUFNGEFP/K+DTymjlsU01O3NhkGtb9rsZRztJXwaiAlmVSX4vSzjydPxpZCRhpWIq4A==", "dev": true, "license": "MIT", "dependencies": { @@ -49852,19 +49851,19 @@ } }, "node_modules/webpack": { - "version": "5.96.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.96.1.tgz", - "integrity": "sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA==", + "version": "5.95.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.95.0.tgz", + "integrity": "sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q==", "dev": true, "license": "MIT", "dependencies": { - "@types/eslint-scope": "^3.7.7", - "@types/estree": "^1.0.6", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.14.0", - "browserslist": "^4.24.0", + "acorn": "^8.7.1", + "acorn-import-attributes": "^1.9.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", diff --git a/mon-pix/package.json b/mon-pix/package.json index f43190c3df3..b28fa8d8c27 100644 --- a/mon-pix/package.json +++ b/mon-pix/package.json @@ -49,11 +49,11 @@ "@1024pix/eslint-plugin": "^2.0.4", "@1024pix/pix-ui": "^52.3.5", "@1024pix/stylelint-config": "^5.1.27", - "@babel/eslint-parser": "^7.19.1", - "@babel/plugin-proposal-decorators": "^7.20.2", + "@babel/eslint-parser": "^7.25.1", + "@babel/plugin-proposal-decorators": "^7.24.7", "@ember-data/json-api": "^5.3.8", "@ember-data/model": "^5.3.8", - "@ember/optional-features": "^2.0.0", + "@ember/optional-features": "^2.1.0", "@ember/string": "^3.1.1", "@ember/test-helpers": "^4.0.0", "@embroider/compat": "^3.0.0", @@ -68,14 +68,14 @@ "buffer": "^6.0.3", "dayjs": "^1.11.6", "dotenv": "^16.0.3", - "ember-auto-import": "^2.4.3", + "ember-auto-import": "^2.8.1", "ember-cli": "^6.0.0", "ember-cli-app-version": "^7.0.0", "ember-cli-autoprefixer": "^2.0.0", "ember-cli-babel": "^8.0.0", "ember-cli-clipboard": "^1.0.0", "ember-cli-dependency-checker": "^3.3.1", - "ember-cli-deprecation-workflow": "^3.0.0", + "ember-cli-deprecation-workflow": "^3.1.0", "ember-cli-htmlbars": "^6.1.1", "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-mirage": "^3.0.3", @@ -97,7 +97,7 @@ "ember-resolver": "^13.0.0", "ember-responsive": "^5.0.0", "ember-simple-auth": "^7.0.0", - "ember-source": "^5.9.0", + "ember-source": "^6.0.0", "ember-template-imports": "^4.1.1", "ember-template-lint": "^6.0.0", "ember-template-lint-plugin-prettier": "^5.0.0", @@ -105,7 +105,7 @@ "ember-truth-helpers": "^4.0.0", "eslint": "^9.17.0", "eslint-config-prettier": "^9.0.0", - "eslint-plugin-ember": "^12.0.0", + "eslint-plugin-ember": "^12.2.1", "eslint-plugin-i18n-json": "^4.0.0", "eslint-plugin-n": "^17.0.0", "eslint-plugin-prettier": "^5.0.0", @@ -122,21 +122,23 @@ "prettier": "^3.0.0", "prettier-plugin-ember-template-tag": "^2.0.2", "qunit": "^2.19.1", - "qunit-dom": "^3.0.0", + "qunit-dom": "^3.2.1", "sass": "^1.56.0", "showdown": "^2.1.0", "sinon": "^19.0.0", "stylelint": "^16.0.0", "stylelint-order": "^6.0.0", - "webpack": "^5.76.0", + "webpack": "^5.95.0", "xss": "^1.0.13" }, "overrides": { - "eslint-plugin-ember": { - "ember-eslint-parser": "^0.5.0" - }, + "ember-eslint-parser": "$ember-eslint-parser", + "ember-source": "$ember-source", "ember-dayjs": { - "ember-source": "^5.8.0" + "ember-source": "$ember-source" + }, + "@ember/render-modifiers": { + "ember-source": "$ember-source" } } } diff --git a/mon-pix/tests/acceptance/account-recovery/find-sco-record-test.js b/mon-pix/tests/acceptance/account-recovery/find-sco-record-test.js index c9e6fbf5303..2e7ac4ea0eb 100644 --- a/mon-pix/tests/acceptance/account-recovery/find-sco-record-test.js +++ b/mon-pix/tests/acceptance/account-recovery/find-sco-record-test.js @@ -64,8 +64,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { module('when submitting information form with valid data', function () { test('should hide student information form and show recover account confirmation step', async function (assert) { // given - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); // when const screen = await visit('/recuperer-mon-compte'); @@ -120,8 +120,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { module('click on "Cancel" button', function () { test('should return to student information form', async function (assert) { // given - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const screen = await visit('/recuperer-mon-compte'); await fillStudentInformationFormAndSubmit(); @@ -166,13 +166,13 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { test('should redirect to account recovery conflict page', async function (assert) { // given this.server.create('user', { - id: 1, + id: '1', firstName, lastName, }); this.server.create('student-information', { - id: 2, + id: '2', ineIna, firstName, lastName, @@ -197,8 +197,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { module('click on "Confirm" button', function () { test('should hide recover account confirmation step and show recover account backup email confirmation', async function (assert) { // given - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const screen = await visit('/recuperer-mon-compte'); await fillStudentInformationFormAndSubmit(); @@ -227,8 +227,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { // given const email = 'john.doe@example.net'; - this.server.create('user', { id: 1, firstName, lastName, username, email }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username, email }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const screen = await visit('/recuperer-mon-compte'); await fillStudentInformationFormAndSubmit(); @@ -255,8 +255,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { // given const newEmail = 'john.doe@example.net'; - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const screen = await visit('/recuperer-mon-compte'); await fillStudentInformationFormAndSubmit(); @@ -288,8 +288,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { // given const newEmail = 'john.doe@example.net'; - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const errorsApi = new Response( 403, @@ -333,8 +333,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { // given const newEmail = 'john.doe@example.net'; - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const errorsApi = new Response( 500, @@ -379,8 +379,8 @@ module('Acceptance | account-recovery | FindScoRecordRoute', function (hooks) { test('should return to student information form', async function (assert) { // given - this.server.create('user', { id: 1, firstName, lastName, username }); - this.server.create('student-information', { id: 2, ineIna, firstName, lastName, birthdate }); + this.server.create('user', { id: '1', firstName, lastName, username }); + this.server.create('student-information', { id: '2', ineIna, firstName, lastName, birthdate }); const screen = await visit('/recuperer-mon-compte'); await fillStudentInformationFormAndSubmit(); diff --git a/mon-pix/tests/acceptance/account-recovery/update-sco-record-test.js b/mon-pix/tests/acceptance/account-recovery/update-sco-record-test.js index 0fa5a3a0841..573954b0500 100644 --- a/mon-pix/tests/acceptance/account-recovery/update-sco-record-test.js +++ b/mon-pix/tests/acceptance/account-recovery/update-sco-record-test.js @@ -165,7 +165,7 @@ module('Acceptance | account-recovery | UpdateScoRecordRoute', function (hooks) const email = 'George@example.net'; const password = 'Password123'; - server.create('user', { id: 2, email, password }); + server.create('user', { id: '2', email, password }); const screen = await visit(`/recuperer-mon-compte/${temporaryKey}`); diff --git a/mon-pix/tests/acceptance/authenticated/certifications/information-test.js b/mon-pix/tests/acceptance/authenticated/certifications/information-test.js index 90d845a9a20..c296eb8c566 100644 --- a/mon-pix/tests/acceptance/authenticated/certifications/information-test.js +++ b/mon-pix/tests/acceptance/authenticated/certifications/information-test.js @@ -24,7 +24,7 @@ module('Acceptance | Certifications | Information', function (hooks) { test('should display the certification instructions page', async function (assert) { // given server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 123, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -59,7 +59,7 @@ module('Acceptance | Certifications | Information', function (hooks) { test('should validate checkbox and redirect to the certification start page', async function (assert) { // given server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 123, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -100,7 +100,7 @@ module('Acceptance | Certifications | Information', function (hooks) { test('should redirect to the certification start page', async function (assert) { // given server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 123, eligibleSubscriptions: null, nonEligibleSubscription: null, diff --git a/mon-pix/tests/acceptance/authentication/password-reset-demand-form-test.js b/mon-pix/tests/acceptance/authentication/password-reset-demand-form-test.js index 3ad9a72e59c..bc6b44eaf76 100644 --- a/mon-pix/tests/acceptance/authentication/password-reset-demand-form-test.js +++ b/mon-pix/tests/acceptance/authentication/password-reset-demand-form-test.js @@ -24,7 +24,7 @@ module('Acceptance | Password reset demand form', function (hooks) { test('stays on "mot de passe oublié" page, and shows success message when email sent correspond to an existing user', async function (assert) { // given this.server.create('user', { - id: 1, + id: '1', firstName: 'Brandone', lastName: 'Martins', email: 'brandone.martins@pix.com', diff --git a/mon-pix/tests/acceptance/authentication/reset-password-form-test.js b/mon-pix/tests/acceptance/authentication/reset-password-form-test.js index 917b55c5d46..7a586af9ddb 100644 --- a/mon-pix/tests/acceptance/authentication/reset-password-form-test.js +++ b/mon-pix/tests/acceptance/authentication/reset-password-form-test.js @@ -17,7 +17,7 @@ module('Acceptance | Reset Password Form', function (hooks) { test('can visit /changer-mot-de-passe when temporaryKey exists', async function (assert) { // given server.create('user', { - id: 1000, + id: '1000', firstName: 'Brandone', lastName: 'Martins', email: 'brandone.martins@pix.com', @@ -39,7 +39,7 @@ module('Acceptance | Reset Password Form', function (hooks) { test('stays on /changer-mot-de-passe when password is successfully reset', async function (assert) { // given server.create('user', { - id: 1000, + id: '1000', firstName: 'Brandone', lastName: 'Martins', email: 'brandone.martins@pix.com', @@ -67,7 +67,7 @@ module('Acceptance | Reset Password Form', function (hooks) { test('allows connected user to visit reset-password page', async function (assert) { // given const user = server.create('user', { - id: 1000, + id: '1000', firstName: 'Brandone', lastName: 'Martins', email: 'brandone.martins@pix.com', diff --git a/mon-pix/tests/acceptance/certification-course-test.js b/mon-pix/tests/acceptance/certification-course-test.js index fc29bbcb7a0..3869834ed48 100644 --- a/mon-pix/tests/acceptance/certification-course-test.js +++ b/mon-pix/tests/acceptance/certification-course-test.js @@ -202,14 +202,14 @@ module('Acceptance | Certification | Certification Course', function (hooks) { // given await visit('/certifications'); this.server.schema.certificationCandidates.create({ - id: 1, + id: '1', firstName: 'Laura', lastName: 'CandidatLiéUtilisateur', sessionId: 1, birthdate: '1990-01-04', }); this.server.create('certification-candidate-subscription', { - id: 1, + id: '1', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -236,7 +236,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { // given await visit('/certifications'); this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -277,7 +277,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { assessment = certificationCourse.assessment; this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -400,7 +400,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { lastName: 'Bravo', }); this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -462,7 +462,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { server.create('challenge', 'forCertification'); server.create('challenge', 'forCertification'); server.create('certification-course', { - id: 99, + id: '99', accessCode: 'ABCD12', sessionId: 1, nbChallenges: 2, @@ -475,7 +475,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { state: assessmentStates.STARTED, }); server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -554,7 +554,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { version: 2, }); this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -605,7 +605,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { }); this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, @@ -651,7 +651,7 @@ module('Acceptance | Certification | Certification Course', function (hooks) { }); this.server.create('certification-candidate-subscription', { - id: 2, + id: '2', sessionId: 1, eligibleSubscriptions: null, nonEligibleSubscription: null, diff --git a/mon-pix/tests/acceptance/challenge-page-banner-test.js b/mon-pix/tests/acceptance/challenge-page-banner-test.js index 82aa4c1bf5c..10a2d116882 100644 --- a/mon-pix/tests/acceptance/challenge-page-banner-test.js +++ b/mon-pix/tests/acceptance/challenge-page-banner-test.js @@ -66,7 +66,7 @@ module('Acceptance | Challenge page banner', function (hooks) { let challenge; hooks.beforeEach(function () { - server.create('feature-toggle', { id: 0, isTextToSpeechButtonEnabled: true }); + server.create('feature-toggle', { id: '0', isTextToSpeechButtonEnabled: true }); assessment = server.create('assessment', 'ofCompetenceEvaluationType', { title: 'Assessment title', }); diff --git a/mon-pix/tests/acceptance/competences-results-test.js b/mon-pix/tests/acceptance/competences-results-test.js index 8ee5ea742f5..3e6b95103ea 100644 --- a/mon-pix/tests/acceptance/competences-results-test.js +++ b/mon-pix/tests/acceptance/competences-results-test.js @@ -40,7 +40,7 @@ module('Acceptance | competences results', function (hooks) { level: 2, }); const olderCompetence = this.server.create('competence-evaluation', { - id: 2, + id: '2', assessmentId: assessmentId, competenceId: 9, userId: user.id, @@ -49,7 +49,7 @@ module('Acceptance | competences results', function (hooks) { olderCompetence.update({ scorecard: olderCompetenceScoreCard }); this.server.create('competence-evaluation', { - id: 1, + id: '1', assessmentId: assessmentId, competenceId: competenceId, userId: user.id, diff --git a/mon-pix/tests/acceptance/resume-campaigns-with-type-assessment-test.js b/mon-pix/tests/acceptance/resume-campaigns-with-type-assessment-test.js index 58fd0d4d4ac..159e696cf9f 100644 --- a/mon-pix/tests/acceptance/resume-campaigns-with-type-assessment-test.js +++ b/mon-pix/tests/acceptance/resume-campaigns-with-type-assessment-test.js @@ -20,7 +20,7 @@ module('Acceptance | Campaigns | Resume Campaigns with type Assessment', functio studentInfo = server.create('user', 'withEmail'); await authenticate(studentInfo); campaign = server.create('campaign', { - id: 23456, + id: '23456', externalIdLabel: 'email', type: ASSESSMENT, }); diff --git a/mon-pix/tests/helpers/service-stubs.js b/mon-pix/tests/helpers/service-stubs.js index f5c4d12bca5..fa8e6a158e3 100644 --- a/mon-pix/tests/helpers/service-stubs.js +++ b/mon-pix/tests/helpers/service-stubs.js @@ -81,7 +81,7 @@ export function stubSessionService(owner, sessionData = {}) { export function stubCurrentUserService(owner, userData = {}, { withStoreStubbed } = { withStoreStubbed: true }) { const isAuthenticated = userData.isAuthenticated ?? true; const isAnonymous = userData.isAnonymous || false; - const id = userData.id || 123; + const id = `${userData.id}` || '123'; const firstName = userData.firstName || 'John'; const lastName = userData.lastName || 'Doe'; const fullName = `${firstName} ${lastName}`; diff --git a/mon-pix/tests/integration/components/Sitemap/content-test.js b/mon-pix/tests/integration/components/Sitemap/content-test.js index a2906f630cc..47cee4de870 100644 --- a/mon-pix/tests/integration/components/Sitemap/content-test.js +++ b/mon-pix/tests/integration/components/Sitemap/content-test.js @@ -38,8 +38,8 @@ module('Integration | Component | Sitemap::Content', function (hooks) { test('should display a sublist within skills containing a link to each skill', async function (assert) { // given const store = this.owner.lookup('service:store'); - const scorecard1 = store.createRecord('scorecard', { id: 1, name: 'Name 1' }); - const scorecard2 = store.createRecord('scorecard', { id: 2, name: 'Name 2' }); + const scorecard1 = store.createRecord('scorecard', { id: '1', name: 'Name 1' }); + const scorecard2 = store.createRecord('scorecard', { id: '2', name: 'Name 2' }); const model = { scorecards: [scorecard1, scorecard2], }; diff --git a/mon-pix/tests/integration/components/campaigns/assessment/results/tabs/trainings-test.js b/mon-pix/tests/integration/components/campaigns/assessment/results/tabs/trainings-test.js index 9bb0267d138..d987c0690de 100644 --- a/mon-pix/tests/integration/components/campaigns/assessment/results/tabs/trainings-test.js +++ b/mon-pix/tests/integration/components/campaigns/assessment/results/tabs/trainings-test.js @@ -129,7 +129,7 @@ module('Integration | Components | Campaigns | Assessment | Evaluation Results T let adapter, storeService; hooks.beforeEach(function () { - stubCurrentUserService(this.owner, { id: 1 }); + stubCurrentUserService(this.owner, { id: '1' }); storeService = this.owner.lookup('service:store'); adapter = storeService.adapterFor('campaign-participation-result'); @@ -153,7 +153,7 @@ module('Integration | Components | Campaigns | Assessment | Evaluation Results T 'campaign-participation-result', { campaignId: this.campaignId, - userId: 1, + userId: '1', }, { reload: true }, ); diff --git a/mon-pix/tests/integration/components/certification-starter-test.js b/mon-pix/tests/integration/components/certification-starter-test.js index bfdda5322c8..9802fe0bb7a 100644 --- a/mon-pix/tests/integration/components/certification-starter-test.js +++ b/mon-pix/tests/integration/components/certification-starter-test.js @@ -198,7 +198,7 @@ module('Integration | Component | certification-starter', function (hooks) { test('should redirect to certifications.resume', async function (assert) { // given const certificationCourse = { - id: 456, + id: '456', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -246,7 +246,7 @@ module('Integration | Component | certification-starter', function (hooks) { sinon.assert.calledOnce(certificationCourse.save); sinon.assert.calledOnce(resetStub); sinon.assert.calledOnce(startCertificationStub); - sinon.assert.calledWithExactly(routerObserver.replaceWith, 'authenticated.certifications.resume', 456); + sinon.assert.calledWithExactly(routerObserver.replaceWith, 'authenticated.certifications.resume', '456'); assert.ok(true); }); @@ -276,7 +276,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -313,7 +313,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -349,7 +349,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -386,7 +386,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -426,7 +426,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; @@ -468,7 +468,7 @@ module('Integration | Component | certification-starter', function (hooks) { this.owner.register('service:store', StoreStubService); const certificationCourse = { - id: 123, + id: '123', save: sinon.stub(), deleteRecord: sinon.stub(), }; diff --git a/mon-pix/tests/integration/components/certifications-list-item-test.js b/mon-pix/tests/integration/components/certifications-list-item-test.js index 54d806211bf..3914f8264cf 100644 --- a/mon-pix/tests/integration/components/certifications-list-item-test.js +++ b/mon-pix/tests/integration/components/certifications-list-item-test.js @@ -235,7 +235,7 @@ module('Integration | Component | certifications list item', function (hooks) { test('should show Certification annulée with comments', async function (assert) { // given const certification = EmberObject.create({ - id: 1, + id: '1', date: '2018-02-15T15:15:52.504Z', status: 'cancelled', certificationCenter: 'Université de Paris', @@ -296,7 +296,7 @@ module('Integration | Component | certifications list item', function (hooks) { function createCertification({ status, isPublished, commentForCandidate }) { return EmberObject.create({ - id: 1, + id: '1', date: '2018-02-15T15:15:52.504Z', certificationCenter: 'Université de Paris', pixScore: 231, diff --git a/mon-pix/tests/integration/components/certifications-list-test.js b/mon-pix/tests/integration/components/certifications-list-test.js index 2c7d705ae80..580c03adf40 100644 --- a/mon-pix/tests/integration/components/certifications-list-test.js +++ b/mon-pix/tests/integration/components/certifications-list-test.js @@ -16,7 +16,7 @@ module('Integration | Component | certifications list', function (hooks) { module('when there is some completed certifications', function () { const certification1 = EmberObject.create({ - id: 1, + id: '1', date: '2018-02-15T15:15:52.504Z', status: 'validated', certificationCenter: 'Université de Paris', @@ -24,7 +24,7 @@ module('Integration | Component | certifications list', function (hooks) { pixScore: 231, }); const certification2 = EmberObject.create({ - id: 2, + id: '2', date: '2018-02-15T15:15:52.504Z', status: 'rejected', certificationCenter: 'Université de Lyon', diff --git a/mon-pix/tests/integration/components/dashboard/content-test.js b/mon-pix/tests/integration/components/dashboard/content-test.js index eb520e1a841..681d2a90f7e 100644 --- a/mon-pix/tests/integration/components/dashboard/content-test.js +++ b/mon-pix/tests/integration/components/dashboard/content-test.js @@ -152,12 +152,12 @@ module('Integration | Component | Dashboard | Content', function (hooks) { test('should render the four first non started competence cards from the received arguments', async function (assert) { // given const scorecards = [ - { id: 1, index: '1.1', isNotStarted: true, name: 'Compétence 1' }, - { id: 2, index: '1.2', isNotStarted: true, name: 'Compétence 2' }, - { id: 3, index: '3.1', isNotStarted: true, name: 'Compétence 3' }, - { id: 5, index: '1.3', isNotStarted: false, name: 'Compétence 4' }, - { id: 4, index: '2.4', isNotStarted: true, name: 'Compétence 5' }, - { id: 6, index: '1.4', isNotStarted: true, name: 'Compétence 6' }, + { id: '1', index: '1.1', isNotStarted: true, name: 'Compétence 1' }, + { id: '2', index: '1.2', isNotStarted: true, name: 'Compétence 2' }, + { id: '3', index: '3.1', isNotStarted: true, name: 'Compétence 3' }, + { id: '5', index: '1.3', isNotStarted: false, name: 'Compétence 4' }, + { id: '4', index: '2.4', isNotStarted: true, name: 'Compétence 5' }, + { id: '6', index: '1.4', isNotStarted: true, name: 'Compétence 6' }, ]; this.set('model', { campaignParticipationOverviews: [], @@ -226,12 +226,12 @@ module('Integration | Component | Dashboard | Content', function (hooks) { test('should render the four first non improvable competence cards from the received arguments', async function (assert) { // given const scorecards = [ - { id: 1, index: '1.1', isImprovable: true, name: 'Compétence 1' }, - { id: 2, index: '1.2', isImprovable: true, name: 'Compétence 2' }, - { id: 3, index: '3.1', isImprovable: true, name: 'Compétence 3' }, - { id: 5, index: '1.3', isImprovable: false, name: 'Compétence 4' }, - { id: 4, index: '2.4', isImprovable: true, name: 'Compétence 5' }, - { id: 4, index: '1.4', isImprovable: true, name: 'Compétence 6' }, + { id: '1', index: '1.1', isImprovable: true, name: 'Compétence 1' }, + { id: '2', index: '1.2', isImprovable: true, name: 'Compétence 2' }, + { id: '3', index: '3.1', isImprovable: true, name: 'Compétence 3' }, + { id: '5', index: '1.3', isImprovable: false, name: 'Compétence 4' }, + { id: '4', index: '2.4', isImprovable: true, name: 'Compétence 5' }, + { id: '4', index: '1.4', isImprovable: true, name: 'Compétence 6' }, ]; this.set('model', { campaignParticipationOverviews: [], @@ -310,12 +310,12 @@ module('Integration | Component | Dashboard | Content', function (hooks) { test('should render the four first started competence cards from the received arguments', async function (assert) { // given const scorecards = [ - { id: 1, index: '1.1', isStarted: true, name: 'Compétence 1' }, - { id: 2, index: '1.2', isStarted: true, name: 'Compétence 2' }, - { id: 3, index: '3.1', isStarted: true, name: 'Compétence 3' }, - { id: 5, index: '1.3', isStarted: false, name: 'Compétence 4' }, - { id: 4, index: '2.4', isStarted: true, name: 'Compétence 5' }, - { id: 4, index: '1.4', isStarted: true, name: 'Compétence 6' }, + { id: '1', index: '1.1', isStarted: true, name: 'Compétence 1' }, + { id: '2', index: '1.2', isStarted: true, name: 'Compétence 2' }, + { id: '3', index: '3.1', isStarted: true, name: 'Compétence 3' }, + { id: '5', index: '1.3', isStarted: false, name: 'Compétence 4' }, + { id: '4', index: '2.4', isStarted: true, name: 'Compétence 5' }, + { id: '4', index: '1.4', isStarted: true, name: 'Compétence 6' }, ]; this.set('model', { campaignParticipationOverviews: [], @@ -521,8 +521,8 @@ module('Integration | Component | Dashboard | Content', function (hooks) { campaignParticipationOverviews: [], campaignParticipations: [], scorecards: [ - { id: 1, index: '1.1', isStarted: true }, - { id: 2, index: '1.2', isStarted: true }, + { id: '1', index: '1.1', isStarted: true }, + { id: '2', index: '1.2', isStarted: true }, ], }); diff --git a/mon-pix/tests/integration/components/pix-toggle-deprecated-test.js b/mon-pix/tests/integration/components/pix-toggle-deprecated-test.js index 03462712c13..4f5305bd484 100644 --- a/mon-pix/tests/integration/components/pix-toggle-deprecated-test.js +++ b/mon-pix/tests/integration/components/pix-toggle-deprecated-test.js @@ -12,9 +12,7 @@ module('Integration | Component | pix-toggle-deprecated', function (hooks) { hooks.beforeEach(async function () { this.set('valueFirstLabel', 'valueFirstLabel'); this.set('valueSecondLabel', 'valueSecondLabel'); - this.set('onToggle', function () { - this.set('loginWithEmail', false); - }); + this.set('onToggle', function () {}); this.set('isFirstOn', 'true'); await render( diff --git a/mon-pix/tests/integration/components/profile-content-test.js b/mon-pix/tests/integration/components/profile-content-test.js index fb991d2fd63..5262bc002ef 100644 --- a/mon-pix/tests/integration/components/profile-content-test.js +++ b/mon-pix/tests/integration/components/profile-content-test.js @@ -25,7 +25,7 @@ module('Integration | Component | Profile-content', function (hooks) { areas: [{ code: 0 }, { code: 1 }], scorecards: [ { - id: 1, + id: '1', areaColor: 0, level: 3, name: 'Name', @@ -36,7 +36,7 @@ module('Integration | Component | Profile-content', function (hooks) { }, }, { - id: 2, + id: '2', areaColor: 1, level: 2, name: 'Name 2', diff --git a/mon-pix/tests/integration/components/result-item-campaign-test.js b/mon-pix/tests/integration/components/result-item-campaign-test.js index 8266b780d4e..d235ac17711 100644 --- a/mon-pix/tests/integration/components/result-item-campaign-test.js +++ b/mon-pix/tests/integration/components/result-item-campaign-test.js @@ -27,10 +27,10 @@ module('Integration | Component | result-item', function (hooks) { const answer = EmberObject.create({ value: '2,4', result: 'ko', - id: 1, + id: '1', challenge: emberChallengeObject, assessment: { - id: 4, + id: '4', }, }); diff --git a/mon-pix/tests/integration/components/user-certifications-detail-header-test.js b/mon-pix/tests/integration/components/user-certifications-detail-header-test.js index 511c72e7331..f27ec512881 100644 --- a/mon-pix/tests/integration/components/user-certifications-detail-header-test.js +++ b/mon-pix/tests/integration/components/user-certifications-detail-header-test.js @@ -18,7 +18,7 @@ module('Integration | Component | user certifications detail header', function ( // given store = this.owner.lookup('service:store'); certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -68,7 +68,7 @@ module('Integration | Component | user certifications detail header', function ( // given const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: null, firstName: null, @@ -106,7 +106,7 @@ module('Integration | Component | user certifications detail header', function ( // given const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -141,7 +141,7 @@ module('Integration | Component | user certifications detail header', function ( // given const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -176,7 +176,7 @@ module('Integration | Component | user certifications detail header', function ( // given const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -218,7 +218,7 @@ module('Integration | Component | user certifications detail header', function ( const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1234, + id: '1234', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -261,7 +261,7 @@ module('Integration | Component | user certifications detail header', function ( const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1, + id: '1', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -299,7 +299,7 @@ module('Integration | Component | user certifications detail header', function ( const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1234, + id: '1234', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', @@ -344,7 +344,7 @@ module('Integration | Component | user certifications detail header', function ( const store = this.owner.lookup('service:store'); const certification = store.createRecord('certification', { - id: 1234, + id: '1234', birthdate: '2000-01-22', birthplace: 'Paris', firstName: 'Jean', diff --git a/mon-pix/tests/integration/components/user-certifications-detail-result-test.js b/mon-pix/tests/integration/components/user-certifications-detail-result-test.js index 2361c850653..37101f9c1e3 100644 --- a/mon-pix/tests/integration/components/user-certifications-detail-result-test.js +++ b/mon-pix/tests/integration/components/user-certifications-detail-result-test.js @@ -15,7 +15,7 @@ module('Integration | Component | user certifications detail result', function ( test('should show the comment for candidate', async function (assert) { // given const certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -40,7 +40,7 @@ module('Integration | Component | user certifications detail result', function ( test('should not show the comment for candidate', async function (assert) { // given const certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -65,7 +65,7 @@ module('Integration | Component | user certifications detail result', function ( test('should show the complementary certification section', async function (assert) { // given certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -95,7 +95,7 @@ module('Integration | Component | user certifications detail result', function ( test('should show the complementary certification badge', async function (assert) { // given certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -127,7 +127,7 @@ module('Integration | Component | user certifications detail result', function ( test('should display the message', async function (assert) { // given certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -162,7 +162,7 @@ module('Integration | Component | user certifications detail result', function ( test('should not show the complementary certification badge', async function (assert) { // given certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', @@ -191,7 +191,7 @@ module('Integration | Component | user certifications detail result', function ( test('should not show the complementary certification badge section', async function (assert) { // given certification = EmberObject.create({ - id: 1, + id: '1', birthdate: new Date('2000-01-22T15:15:52Z'), firstName: 'Jean', lastName: 'Bon', diff --git a/mon-pix/tests/integration/components/user-certifications-panel-test.js b/mon-pix/tests/integration/components/user-certifications-panel-test.js index a0bfe7707cd..9ca04912fbe 100644 --- a/mon-pix/tests/integration/components/user-certifications-panel-test.js +++ b/mon-pix/tests/integration/components/user-certifications-panel-test.js @@ -22,13 +22,13 @@ module('Integration | Component | user certifications panel', function (hooks) { test('should render a certifications list', async function (assert) { // given const certification1 = EmberObject.create({ - id: 1, + id: '1', date: '2018-02-15T15:15:52.504Z', status: 'completed', certificationCenter: 'Université de Paris', }); const certification2 = EmberObject.create({ - id: 2, + id: '2', date: '2018-02-15T15:15:52.504Z', status: 'completed', certificationCenter: 'Université de Lyon', diff --git a/mon-pix/tests/integration/components/user-logged-menu-test.js b/mon-pix/tests/integration/components/user-logged-menu-test.js index a00a727329b..ef5b6da7202 100644 --- a/mon-pix/tests/integration/components/user-logged-menu-test.js +++ b/mon-pix/tests/integration/components/user-logged-menu-test.js @@ -171,7 +171,7 @@ module('Integration | Component | user logged menu', function (hooks) { module('when user has at least one participation', function (hooks) { hooks.beforeEach(function () { stubCurrentUserService(this.owner, { - id: 456, + id: '456', firstName: 'Hermione', lastName: 'Granger', hasAssessmentParticipations: true, diff --git a/mon-pix/tests/unit/adapters/element-answer-test.js b/mon-pix/tests/unit/adapters/element-answer-test.js index b782a3ee8ab..9221238916e 100644 --- a/mon-pix/tests/unit/adapters/element-answer-test.js +++ b/mon-pix/tests/unit/adapters/element-answer-test.js @@ -29,7 +29,7 @@ module('Unit | Adapter | Module | ElementAnswer', function (hooks) { test('should build the right payload', async function (assert) { // given const store = this.owner.lookup('service:store'); - const passageId = 12; + const passageId = '12'; const passage = store.createRecord('passage', { id: passageId }); const adapter = this.owner.lookup('adapter:element-answer'); adapter.ajax = sinon.stub().resolves(); diff --git a/mon-pix/tests/unit/adapters/email-verification-code-test.js b/mon-pix/tests/unit/adapters/email-verification-code-test.js index 7bbdf850791..5851c6e26ea 100644 --- a/mon-pix/tests/unit/adapters/email-verification-code-test.js +++ b/mon-pix/tests/unit/adapters/email-verification-code-test.js @@ -9,7 +9,7 @@ module('Unit | Adapter | Email-Verification-Code', function (hooks) { module('#buildURL', function () { test('should call API to send email verification code', async function (assert) { // given - const currentUserService = stubCurrentUserService(this.owner, { id: 123 }); + const currentUserService = stubCurrentUserService(this.owner, { id: '123' }); currentUserService.user.get.returns(123); // when diff --git a/mon-pix/tests/unit/adapters/tutorial-evaluation-test.js b/mon-pix/tests/unit/adapters/tutorial-evaluation-test.js index ed5bb13a57a..abac50204db 100644 --- a/mon-pix/tests/unit/adapters/tutorial-evaluation-test.js +++ b/mon-pix/tests/unit/adapters/tutorial-evaluation-test.js @@ -68,7 +68,7 @@ module('Unit | Adapters | tutorial-evaluation', function (hooks) { // given const tutorialId = 'tutorialId'; const tutorial = { - id: 12, + id: '12', adapterOptions: { tutorialId, status: 'LIKED' }, serialize: function () {}, }; diff --git a/mon-pix/tests/unit/components/assessments/assessments-test.js b/mon-pix/tests/unit/components/assessments/assessments-test.js index a0a16047a39..b0925101729 100644 --- a/mon-pix/tests/unit/components/assessments/assessments-test.js +++ b/mon-pix/tests/unit/components/assessments/assessments-test.js @@ -10,7 +10,7 @@ module('Unit | Component | Assessments | Assessments', function (hooks) { test('should create a companion live alert and reload assessment', async function (assert) { // given const assessment = { - id: 123, + id: '123', isCertification: true, reload: sinon.stub(), }; @@ -25,7 +25,7 @@ module('Unit | Component | Assessments | Assessments', function (hooks) { await component.createLiveAlert(); // then - sinon.assert.calledOnceWithExactly(createCompanionLiveAlertStub, { assessmentId: 123 }); + sinon.assert.calledOnceWithExactly(createCompanionLiveAlertStub, { assessmentId: '123' }); sinon.assert.calledOnceWithExactly(assessment.reload); assert.ok(true); }); diff --git a/mon-pix/tests/unit/components/certification-instructions/steps-test.js b/mon-pix/tests/unit/components/certification-instructions/steps-test.js index a086c771bd8..4706f6d7636 100644 --- a/mon-pix/tests/unit/components/certification-instructions/steps-test.js +++ b/mon-pix/tests/unit/components/certification-instructions/steps-test.js @@ -42,14 +42,14 @@ module('Unit | Component | certification-instruction | steps', function (hooks) }; component.args.candidate = { save: saveStub, - id: 123, + id: '123', }; // when await component.nextStep(); // then - assert.ok(transitionToStub.calledWith('authenticated.certifications.start', 123)); + assert.ok(transitionToStub.calledWith('authenticated.certifications.start', '123')); }); }); }); diff --git a/mon-pix/tests/unit/components/dashboard/content-test.js b/mon-pix/tests/unit/components/dashboard/content-test.js index 39021a6f31c..a6df1d64e83 100644 --- a/mon-pix/tests/unit/components/dashboard/content-test.js +++ b/mon-pix/tests/unit/components/dashboard/content-test.js @@ -17,18 +17,18 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return non-started scorecards', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: true }, - { id: 2, isNotStarted: true }, - { id: 4, isNotStarted: true }, - { id: 5, isNotStarted: false }, - { id: 3, isNotStarted: true }, + { id: '1', isNotStarted: true }, + { id: '2', isNotStarted: true }, + { id: '4', isNotStarted: true }, + { id: '5', isNotStarted: false }, + { id: '3', isNotStarted: true }, ]; const expectedScorecards = [ - { id: 1, isNotStarted: true }, - { id: 2, isNotStarted: true }, - { id: 4, isNotStarted: true }, - { id: 3, isNotStarted: true }, + { id: '1', isNotStarted: true }, + { id: '2', isNotStarted: true }, + { id: '4', isNotStarted: true }, + { id: '3', isNotStarted: true }, ]; component.args.model = { scorecards }; @@ -43,15 +43,15 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return scorecards ordered by index', function (assert) { // given const scorecards = [ - { id: 3, index: '3.1', isNotStarted: true }, - { id: 1, index: '1.1', isNotStarted: true }, - { id: 4, index: '2.4', isNotStarted: true }, + { id: '3', index: '3.1', isNotStarted: true }, + { id: '1', index: '1.1', isNotStarted: true }, + { id: '4', index: '2.4', isNotStarted: true }, ]; const expectedScorecards = [ - { id: 1, index: '1.1', isNotStarted: true }, - { id: 4, index: '2.4', isNotStarted: true }, - { id: 3, index: '3.1', isNotStarted: true }, + { id: '1', index: '1.1', isNotStarted: true }, + { id: '4', index: '2.4', isNotStarted: true }, + { id: '3', index: '3.1', isNotStarted: true }, ]; component.args.model = { scorecards }; @@ -66,18 +66,18 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return a maximum of four cards', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: true }, - { id: 2, isNotStarted: true }, - { id: 4, isNotStarted: true }, - { id: 5, isNotStarted: true }, - { id: 3, isNotStarted: true }, + { id: '1', isNotStarted: true }, + { id: '2', isNotStarted: true }, + { id: '4', isNotStarted: true }, + { id: '5', isNotStarted: true }, + { id: '3', isNotStarted: true }, ]; const expectedScorecards = [ - { id: 1, isNotStarted: true }, - { id: 2, isNotStarted: true }, - { id: 4, isNotStarted: true }, - { id: 5, isNotStarted: true }, + { id: '1', isNotStarted: true }, + { id: '2', isNotStarted: true }, + { id: '4', isNotStarted: true }, + { id: '5', isNotStarted: true }, ]; component.args.model = EmberObject.create({ scorecards }); @@ -94,18 +94,18 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return started competences', function (assert) { // given const scorecards = [ - { id: 1, isStarted: true }, - { id: 2, isStarted: true }, - { id: 4, isStarted: true }, - { id: 5, isStarted: false }, - { id: 3, isStarted: true }, + { id: '1', isStarted: true }, + { id: '2', isStarted: true }, + { id: '4', isStarted: true }, + { id: '5', isStarted: false }, + { id: '3', isStarted: true }, ]; const expectedScorecards = [ - { id: 1, isStarted: true }, - { id: 2, isStarted: true }, - { id: 4, isStarted: true }, - { id: 3, isStarted: true }, + { id: '1', isStarted: true }, + { id: '2', isStarted: true }, + { id: '4', isStarted: true }, + { id: '3', isStarted: true }, ]; component.args.model = { scorecards }; @@ -120,15 +120,15 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return scorecards ordered by index', function (assert) { // given const scorecards = [ - { id: 3, index: '3.1', isStarted: true }, - { id: 1, index: '1.1', isStarted: true }, - { id: 4, index: '2.4', isStarted: true }, + { id: '3', index: '3.1', isStarted: true }, + { id: '1', index: '1.1', isStarted: true }, + { id: '4', index: '2.4', isStarted: true }, ]; const expectedScorecards = [ - { id: 1, index: '1.1', isStarted: true }, - { id: 4, index: '2.4', isStarted: true }, - { id: 3, index: '3.1', isStarted: true }, + { id: '1', index: '1.1', isStarted: true }, + { id: '4', index: '2.4', isStarted: true }, + { id: '3', index: '3.1', isStarted: true }, ]; component.args.model = { scorecards }; @@ -143,18 +143,18 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return a maximum of four cards', function (assert) { // given const scorecards = [ - { id: 1, isStarted: true }, - { id: 2, isStarted: true }, - { id: 4, isStarted: true }, - { id: 5, isStarted: true }, - { id: 3, isStarted: true }, + { id: '1', isStarted: true }, + { id: '2', isStarted: true }, + { id: '4', isStarted: true }, + { id: '5', isStarted: true }, + { id: '3', isStarted: true }, ]; const expectedScorecards = [ - { id: 1, isStarted: true }, - { id: 2, isStarted: true }, - { id: 4, isStarted: true }, - { id: 5, isStarted: true }, + { id: '1', isStarted: true }, + { id: '2', isStarted: true }, + { id: '4', isStarted: true }, + { id: '5', isStarted: true }, ]; component.args.model = EmberObject.create({ scorecards }); @@ -171,13 +171,13 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return improvable scorecards', function (assert) { // given const scorecards = [ - { id: 1, isImprovable: false }, - { id: 2, isImprovable: false }, - { id: 5, isImprovable: true }, - { id: 3, isImprovable: false }, + { id: '1', isImprovable: false }, + { id: '2', isImprovable: false }, + { id: '5', isImprovable: true }, + { id: '3', isImprovable: false }, ]; - const expectedScorecards = [{ id: 5, isImprovable: true }]; + const expectedScorecards = [{ id: '5', isImprovable: true }]; component.args.model = { scorecards }; @@ -191,15 +191,15 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return scorecards ordered by index', function (assert) { // given const scorecards = [ - { id: 3, index: '3.1', isImprovable: true }, - { id: 1, index: '1.1', isImprovable: true }, - { id: 4, index: '2.4', isImprovable: true }, + { id: '3', index: '3.1', isImprovable: true }, + { id: '1', index: '1.1', isImprovable: true }, + { id: '4', index: '2.4', isImprovable: true }, ]; const expectedScorecards = [ - { id: 1, index: '1.1', isImprovable: true }, - { id: 4, index: '2.4', isImprovable: true }, - { id: 3, index: '3.1', isImprovable: true }, + { id: '1', index: '1.1', isImprovable: true }, + { id: '4', index: '2.4', isImprovable: true }, + { id: '3', index: '3.1', isImprovable: true }, ]; component.args.model = { scorecards }; @@ -214,18 +214,18 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return a maximum of four cards', function (assert) { // given const scorecards = [ - { id: 1, isImprovable: true }, - { id: 2, isImprovable: true }, - { id: 4, isImprovable: true }, - { id: 5, isImprovable: true }, - { id: 3, isImprovable: true }, + { id: '1', isImprovable: true }, + { id: '2', isImprovable: true }, + { id: '4', isImprovable: true }, + { id: '5', isImprovable: true }, + { id: '3', isImprovable: true }, ]; const expectedScorecards = [ - { id: 1, isImprovable: true }, - { id: 2, isImprovable: true }, - { id: 4, isImprovable: true }, - { id: 5, isImprovable: true }, + { id: '1', isImprovable: true }, + { id: '2', isImprovable: true }, + { id: '4', isImprovable: true }, + { id: '5', isImprovable: true }, ]; component.args.model = EmberObject.create({ scorecards }); @@ -256,11 +256,11 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return true when there is nothing to show', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: false, isStarted: false }, - { id: 2, isNotStarted: false, isStarted: false }, - { id: 4, isNotStarted: false, isStarted: false }, - { id: 5, isNotStarted: false, isStarted: false }, - { id: 3, isNotStarted: false, isStarted: false }, + { id: '1', isNotStarted: false, isStarted: false }, + { id: '2', isNotStarted: false, isStarted: false }, + { id: '4', isNotStarted: false, isStarted: false }, + { id: '5', isNotStarted: false, isStarted: false }, + { id: '3', isNotStarted: false, isStarted: false }, ]; component.args.model = { scorecards, campaignParticipationOverviews: [] }; @@ -275,11 +275,11 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return false when there is one competence started', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: false, isStarted: true }, - { id: 2, isNotStarted: false, isStarted: false }, - { id: 4, isNotStarted: false, isStarted: false }, - { id: 5, isNotStarted: false, isStarted: false }, - { id: 3, isNotStarted: false, isStarted: false }, + { id: '1', isNotStarted: false, isStarted: true }, + { id: '2', isNotStarted: false, isStarted: false }, + { id: '4', isNotStarted: false, isStarted: false }, + { id: '5', isNotStarted: false, isStarted: false }, + { id: '3', isNotStarted: false, isStarted: false }, ]; component.args.model = { scorecards, campaignParticipationOverviews: [] }; @@ -294,11 +294,11 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return false when there is one competence not started', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: false, isStarted: false }, - { id: 2, isNotStarted: true, isStarted: false }, - { id: 4, isNotStarted: false, isStarted: false }, - { id: 5, isNotStarted: false, isStarted: false }, - { id: 3, isNotStarted: false, isStarted: false }, + { id: '1', isNotStarted: false, isStarted: false }, + { id: '2', isNotStarted: true, isStarted: false }, + { id: '4', isNotStarted: false, isStarted: false }, + { id: '5', isNotStarted: false, isStarted: false }, + { id: '3', isNotStarted: false, isStarted: false }, ]; component.args.model = { scorecards, campaignParticipationOverviews: [] }; @@ -313,13 +313,13 @@ module('Unit | Component | Dashboard | Content', function (hooks) { test('should return false when there is one campaign participation', function (assert) { // given const scorecards = [ - { id: 1, isNotStarted: false, isStarted: false }, - { id: 2, isNotStarted: false, isStarted: false }, - { id: 4, isNotStarted: false, isStarted: false }, - { id: 5, isNotStarted: false, isStarted: false }, - { id: 3, isNotStarted: false, isStarted: false }, + { id: '1', isNotStarted: false, isStarted: false }, + { id: '2', isNotStarted: false, isStarted: false }, + { id: '4', isNotStarted: false, isStarted: false }, + { id: '5', isNotStarted: false, isStarted: false }, + { id: '3', isNotStarted: false, isStarted: false }, ]; - const campaignParticipationOverviews = [{ id: 1 }]; + const campaignParticipationOverviews = [{ id: '1' }]; component.args.model = { scorecards, campaignParticipationOverviews }; diff --git a/mon-pix/tests/unit/components/tutorials/card-test.js b/mon-pix/tests/unit/components/tutorials/card-test.js index 80ff991f4a4..70b616a9104 100644 --- a/mon-pix/tests/unit/components/tutorials/card-test.js +++ b/mon-pix/tests/unit/components/tutorials/card-test.js @@ -126,7 +126,7 @@ module('Unit | Component | Tutorial | card item', function (hooks) { await component.toggleSaveTutorial(); // then - sinon.assert.calledWith(store.createRecord, 'userSavedTutorial', { tutorial }); + sinon.assert.calledWith(store.createRecord, 'user-saved-tutorial', { tutorial }); assert.ok(true); }); diff --git a/mon-pix/tests/unit/controllers/assessments/challenge-test.js b/mon-pix/tests/unit/controllers/assessments/challenge-test.js index d84c1954ad0..17e42fe4f4b 100644 --- a/mon-pix/tests/unit/controllers/assessments/challenge-test.js +++ b/mon-pix/tests/unit/controllers/assessments/challenge-test.js @@ -237,11 +237,11 @@ module('Unit | Controller | Assessments | Challenge', function (hooks) { controller.model = { assessment: { reload: sinon.stub(), - id: 123, + id: '123', state: 'started', }, challenge: { - id: 456, + id: '456', }, }; const store = this.owner.lookup('service:store'); @@ -253,7 +253,7 @@ module('Unit | Controller | Assessments | Challenge', function (hooks) { // then assert.ok(createLiveAlertStub.calledOnce); - sinon.assert.calledWithExactly(createLiveAlertStub, 123, 456); + sinon.assert.calledWithExactly(createLiveAlertStub, '123', '456'); }); test('should reload the model', async function (assert) { @@ -261,11 +261,11 @@ module('Unit | Controller | Assessments | Challenge', function (hooks) { controller.model = { assessment: { reload: sinon.stub(), - id: 123, + id: '123', state: 'started', }, challenge: { - id: 456, + id: '456', }, }; const store = this.owner.lookup('service:store'); diff --git a/mon-pix/tests/unit/controllers/campaigns/profiles-collection/send-profile-test.js b/mon-pix/tests/unit/controllers/campaigns/profiles-collection/send-profile-test.js index 49dd5d4bef1..105fcd09232 100644 --- a/mon-pix/tests/unit/controllers/campaigns/profiles-collection/send-profile-test.js +++ b/mon-pix/tests/unit/controllers/campaigns/profiles-collection/send-profile-test.js @@ -6,7 +6,7 @@ module('Unit | Controller | campaigns/profiles-collection/send-profile', functio setupTest(hooks); const campaignParticipation = { - id: 8654, + id: '8654', isShared: false, save: sinon.stub(), set: sinon.stub().resolves(), @@ -16,7 +16,7 @@ module('Unit | Controller | campaigns/profiles-collection/send-profile', functio const model = { campaign: { - id: 1243, + id: '1243', code: 'CODECAMPAIGN', isAccessible: true, }, diff --git a/mon-pix/tests/unit/helpers/convert-to-html-test.js b/mon-pix/tests/unit/helpers/convert-to-html-test.js index 9cc555182d4..a110213eca1 100644 --- a/mon-pix/tests/unit/helpers/convert-to-html-test.js +++ b/mon-pix/tests/unit/helpers/convert-to-html-test.js @@ -10,14 +10,14 @@ module('Unit | Helper | ConvertToHtml', function () { }); test('should return html formatted result', function (assert) { - const boldSentence = new Array(['**a bold sentence**']); + const boldSentence = ['**a bold sentence**']; const result = helper.compute(boldSentence); assert.strictEqual(result, '

a bold sentence

'); }); test('should return a string without html/css artifacts', function (assert) { - const input = new Array(['**a bold sentence**']); + const input = ['**a bold sentence**']; const result = helper.compute(input); assert.strictEqual(result, '

a bold sentence

'); @@ -31,7 +31,7 @@ module('Unit | Helper | ConvertToHtml', function () { }); test('should return an empty string when called with an empty argument', function (assert) { - const emptyArgument = new Array(['']); + const emptyArgument = ['']; const result = helper.compute(emptyArgument); assert.strictEqual(result, ''); diff --git a/mon-pix/tests/unit/models/shared-profile-for-campaign-test.js b/mon-pix/tests/unit/models/shared-profile-for-campaign-test.js index 4692f0c123b..f53b662136f 100644 --- a/mon-pix/tests/unit/models/shared-profile-for-campaign-test.js +++ b/mon-pix/tests/unit/models/shared-profile-for-campaign-test.js @@ -19,7 +19,7 @@ module('Unit | Model | SharedProfileForCampaign model', function (hooks) { const scorecard2 = store.createRecord('scorecard', { area: area1 }); const scorecard3 = store.createRecord('scorecard', { area: area2 }); - const model = store.createRecord('sharedProfileForCampaign'); + const model = store.createRecord('shared-profile-for-campaign'); model.scorecards = [scorecard1, scorecard2, scorecard3]; // when diff --git a/mon-pix/tests/unit/routes/assessments-test.js b/mon-pix/tests/unit/routes/assessments-test.js index 6d78c680fec..52320fd6bbf 100644 --- a/mon-pix/tests/unit/routes/assessments-test.js +++ b/mon-pix/tests/unit/routes/assessments-test.js @@ -17,7 +17,7 @@ module('Unit | Route | Assessments', function (hooks) { module('#afterModel', function () { test('should return the title when the assessment is not a certification ', function (assert) { // given - const assessment = EmberObject.create({ id: 1, title: 'Programmer', isCertification: false }); + const assessment = EmberObject.create({ id: '1', title: 'Programmer', isCertification: false }); // when const model = route.afterModel(assessment); @@ -28,7 +28,7 @@ module('Unit | Route | Assessments', function (hooks) { test('should update the title when the assessment is a certification ', function (assert) { // given - const assessment = EmberObject.create({ id: 1, title: 1223, isCertification: true }); + const assessment = EmberObject.create({ id: '1', title: 1223, isCertification: true }); // when const model = route.afterModel(assessment); diff --git a/mon-pix/tests/unit/routes/assessments/challenge-test.js b/mon-pix/tests/unit/routes/assessments/challenge-test.js index c4a41bda09c..554eb231c38 100644 --- a/mon-pix/tests/unit/routes/assessments/challenge-test.js +++ b/mon-pix/tests/unit/routes/assessments/challenge-test.js @@ -122,7 +122,7 @@ module('Unit | Route | Assessments | Challenge', function (hooks) { hooks.beforeEach(function () { answer = { - id: 3, + id: '3', challenge: { id: 'oldRecId', get: () => 'oldRecId', diff --git a/mon-pix/tests/unit/routes/assessments/results-test.js b/mon-pix/tests/unit/routes/assessments/results-test.js index 44b638edc4c..2d00207f496 100644 --- a/mon-pix/tests/unit/routes/assessments/results-test.js +++ b/mon-pix/tests/unit/routes/assessments/results-test.js @@ -17,7 +17,7 @@ module('Unit | Route | Assessments | Results', function (hooks) { const route = this.owner.lookup('route:assessments.results'); route.router = { transitionTo: sinon.spy() }; - const assessment = EmberObject.create({ id: 123, isCertification: true }); + const assessment = EmberObject.create({ id: '123', isCertification: true }); // when route.afterModel(assessment); @@ -32,7 +32,7 @@ module('Unit | Route | Assessments | Results', function (hooks) { const route = this.owner.lookup('route:assessments.results'); route.router = { transitionTo: sinon.spy() }; - const assessment = EmberObject.create({ id: 123, isCertification: false, answers: [] }); + const assessment = EmberObject.create({ id: '123', isCertification: false, answers: [] }); // when route.afterModel(assessment); diff --git a/mon-pix/tests/unit/routes/assessments/resume-test.js b/mon-pix/tests/unit/routes/assessments/resume-test.js index 65bbc3dc319..32dc5dfd071 100644 --- a/mon-pix/tests/unit/routes/assessments/resume-test.js +++ b/mon-pix/tests/unit/routes/assessments/resume-test.js @@ -32,7 +32,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { hooks.beforeEach(function () { const answers = EmberObject.create(); answers.reload = sinon.stub().resolves(); - assessment = EmberObject.create({ id: 123, isDemo: true, competenceId: 'recCompetenceId', answers }); + assessment = EmberObject.create({ id: '123', isDemo: true, competenceId: 'recCompetenceId', answers }); assessment.save = sinon.stub().resolves(); }); @@ -40,7 +40,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { let nextChallenge; hooks.beforeEach(function () { - nextChallenge = EmberObject.create({ id: 456 }); + nextChallenge = EmberObject.create({ id: '456' }); queryRecordStub.resolves(nextChallenge); route.assessmentHasNoMoreQuestions = false; }); @@ -70,7 +70,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { sinon.assert.calledOnce(route.router.replaceWith); - sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', 123); + sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', '123'); assert.ok(true); }); }); @@ -88,7 +88,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { sinon.assert.calledOnce(route.router.replaceWith); - sinon.assert.calledWith(route.router.replaceWith, 'assessments.checkpoint', 123); + sinon.assert.calledWith(route.router.replaceWith, 'assessments.checkpoint', '123'); assert.ok(true); }); }); @@ -103,7 +103,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { sinon.assert.calledOnce(route.router.replaceWith); - sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', 123); + sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', '123'); assert.ok(true); }); }); @@ -121,7 +121,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { sinon.assert.calledOnce(route.router.replaceWith); - sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', 123); + sinon.assert.calledWith(route.router.replaceWith, 'assessments.challenge', '123'); assert.ok(true); }); }); @@ -177,7 +177,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { sinon.assert.calledOnce(route.router.replaceWith); - sinon.assert.calledWith(route.router.replaceWith, 'assessments.checkpoint', 123, { + sinon.assert.calledWith(route.router.replaceWith, 'assessments.checkpoint', '123', { queryParams: { finalCheckpoint: true, newLevel: null, competenceLeveled: null }, }); assert.ok(true); @@ -231,7 +231,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { - sinon.assert.calledWith(route.router.replaceWith, 'authenticated.competences.results', competenceId, 123); + sinon.assert.calledWith(route.router.replaceWith, 'authenticated.competences.results', competenceId, '123'); assert.ok(true); }); }); @@ -244,7 +244,7 @@ module('Unit | Route | Assessments | Resume', function (hooks) { // then return promise.then(() => { - sinon.assert.calledWith(route.router.replaceWith, 'assessments.results', 123); + sinon.assert.calledWith(route.router.replaceWith, 'assessments.results', '123'); assert.ok(true); }); }); diff --git a/mon-pix/tests/unit/routes/authenticated/certifications/results-test.js b/mon-pix/tests/unit/routes/authenticated/certifications/results-test.js index b468c84f764..b04e267f07e 100644 --- a/mon-pix/tests/unit/routes/authenticated/certifications/results-test.js +++ b/mon-pix/tests/unit/routes/authenticated/certifications/results-test.js @@ -13,7 +13,7 @@ module('Unit | Route | Certifications | Results', function (hooks) { const reloadStub = sinon.stub().resolves(); const assessment = EmberObject.create({ reload: reloadStub }); const certificationCourse = EmberObject.create({ - id: 1, + id: '1', assessment, }); const findRecordStub = sinon.stub().resolves(certificationCourse); diff --git a/mon-pix/tests/unit/routes/authenticated/certifications/resume-test.js b/mon-pix/tests/unit/routes/authenticated/certifications/resume-test.js index 3c874a8824e..eb2cc8c2bc2 100644 --- a/mon-pix/tests/unit/routes/authenticated/certifications/resume-test.js +++ b/mon-pix/tests/unit/routes/authenticated/certifications/resume-test.js @@ -19,7 +19,7 @@ module('Unit | Route | Certification | Resume', function (hooks) { const params = { certification_course_id: certificationCourseId }; hooks.beforeEach(function () { - assessment = EmberObject.create({ id: 123 }); + assessment = EmberObject.create({ id: '123' }); getAssessmentStub = sinon.stub().returns(assessment); queryStub = sinon.stub().resolves({ get: getAssessmentStub, diff --git a/mon-pix/tests/unit/routes/authenticated/competences/results-test.js b/mon-pix/tests/unit/routes/authenticated/competences/results-test.js index 54aae382a61..3782a6795a5 100644 --- a/mon-pix/tests/unit/routes/authenticated/competences/results-test.js +++ b/mon-pix/tests/unit/routes/authenticated/competences/results-test.js @@ -34,23 +34,33 @@ module('Unit | Route | Competences | Results', function (hooks) { test('should return the most recent competence-evaluation for a given assessment', async function (assert) { // Given const tutorial = { - id: 1, + id: '1', }; const scorecard = { - id: 1, + id: '1', hasMany: sinon.stub(), }; scorecard.hasMany.returns({ reload: sinon.stub().resolves([tutorial]) }); belongsToStub = sinon.stub().returns({ reload: sinon.stub().resolves(scorecard) }); const competenceEvaluationsInStore = A([ - { id: 1, createdAt: new Date('2020-01-01'), assessment: { get: () => assessmentId }, belongsTo: belongsToStub }, - { id: 2, createdAt: new Date('2020-02-01'), assessment: { get: () => assessmentId }, belongsTo: belongsToStub }, - { id: 3, createdAt: new Date('2020-03-01'), assessment: { get: () => 456 }, belongsTo: belongsToStub }, + { + id: '1', + createdAt: new Date('2020-01-01'), + assessment: { get: () => assessmentId }, + belongsTo: belongsToStub, + }, + { + id: '2', + createdAt: new Date('2020-02-01'), + assessment: { get: () => assessmentId }, + belongsTo: belongsToStub, + }, + { id: '3', createdAt: new Date('2020-03-01'), assessment: { get: () => 456 }, belongsTo: belongsToStub }, ]); findAllStub - .withArgs('competenceEvaluation', { reload: true, adapterOptions: { assessmentId } }) + .withArgs('competence-evaluation', { reload: true, adapterOptions: { assessmentId } }) .resolves(competenceEvaluationsInStore); // When @@ -59,8 +69,8 @@ module('Unit | Route | Competences | Results', function (hooks) { }); // Then - assert.strictEqual(model.competenceEvaluation.id, 2); - assert.strictEqual(model.scorecard.id, 1); + assert.strictEqual(model.competenceEvaluation.id, '2'); + assert.strictEqual(model.scorecard.id, '1'); }); }); }); diff --git a/mon-pix/tests/unit/routes/authenticated/competences/resume-test.js b/mon-pix/tests/unit/routes/authenticated/competences/resume-test.js index 490a899ddce..4b1000f79cf 100644 --- a/mon-pix/tests/unit/routes/authenticated/competences/resume-test.js +++ b/mon-pix/tests/unit/routes/authenticated/competences/resume-test.js @@ -15,7 +15,7 @@ module('Unit | Route | Competence | Resume', function (hooks) { let competenceEvaluation; hooks.beforeEach(function () { - competenceEvaluation = EmberObject.create({ id: 123, competenceId }); + competenceEvaluation = EmberObject.create({ id: '123', competenceId }); queryRecordStub = sinon.stub().resolves(competenceEvaluation); storeStub = Service.create({ diff --git a/mon-pix/tests/unit/routes/authenticated/user-certifications/get-test.js b/mon-pix/tests/unit/routes/authenticated/user-certifications/get-test.js index a025264994d..af34a4a0d06 100644 --- a/mon-pix/tests/unit/routes/authenticated/user-certifications/get-test.js +++ b/mon-pix/tests/unit/routes/authenticated/user-certifications/get-test.js @@ -49,7 +49,7 @@ module('Unit | Route | user certifications/get', function (hooks) { // given const params = { id: certificationId }; const retrievedCertification = EmberObject.create({ - id: 2, + id: '2', date: '2018-02-15T15:15:52.504Z', status: 'validated', certificationCenter: 'Université de Lyon', @@ -69,7 +69,7 @@ module('Unit | Route | user certifications/get', function (hooks) { // given const params = { id: certificationId }; const retreivedCertification = EmberObject.create({ - id: 2, + id: '2', date: '2018-02-15T15:15:52.504Z', status: 'validated', certificationCenter: 'Université de Lyon', @@ -91,7 +91,7 @@ module('Unit | Route | user certifications/get', function (hooks) { // given const params = { id: certificationId }; const retreivedCertification = EmberObject.create({ - id: 3, + id: '3', date: '2018-02-15T15:15:52.504Z', status: 'rejected', certificationCenter: 'Université de Lyon', diff --git a/mon-pix/tests/unit/routes/authenticated/user-certifications/index-test.js b/mon-pix/tests/unit/routes/authenticated/user-certifications/index-test.js index 8ba2156d0ec..904eee33bf6 100644 --- a/mon-pix/tests/unit/routes/authenticated/user-certifications/index-test.js +++ b/mon-pix/tests/unit/routes/authenticated/user-certifications/index-test.js @@ -28,13 +28,13 @@ module('Unit | Route | user certifications/index', function (hooks) { test('should return connected user certifications', async function (assert) { // given - const certifications = [EmberObject.create({ id: 1 })]; + const certifications = [EmberObject.create({ id: '1' })]; findAll.resolves(certifications); // when const result = await route.model(); // then - assert.strictEqual(result[0].id, 1); + assert.strictEqual(result[0].id, '1'); }); }); diff --git a/mon-pix/tests/unit/routes/authenticated/user-dashboard-test.js b/mon-pix/tests/unit/routes/authenticated/user-dashboard-test.js index b968b919430..30096a5313b 100644 --- a/mon-pix/tests/unit/routes/authenticated/user-dashboard-test.js +++ b/mon-pix/tests/unit/routes/authenticated/user-dashboard-test.js @@ -10,7 +10,7 @@ module('Unit | Route | User-Dashboard', function (hooks) { module('#model', function () { test('should returns the model that contains campaignParticipationOverviews and scorecards', async function (assert) { // given - const scorecards = [EmberObject.create({ id: 3 }), EmberObject.create({ id: 8 })]; + const scorecards = [EmberObject.create({ id: '3' }), EmberObject.create({ id: '8' })]; const profile = EmberObject.create({ scorecards }); const belongsToReloadStub = sinon.stub().returns(profile); const belongsToStub = sinon.stub().returns({ reload: belongsToReloadStub }); @@ -21,7 +21,7 @@ module('Unit | Route | User-Dashboard', function (hooks) { }, }); - const campaignParticipationOverviews = [EmberObject.create({ id: 10 })]; + const campaignParticipationOverviews = [EmberObject.create({ id: '10' })]; const storeStub = { query: sinon.stub().returns(campaignParticipationOverviews) }; const route = this.owner.lookup('route:authenticated.user-dashboard'); diff --git a/mon-pix/tests/unit/routes/authenticated/user-tests-test.js b/mon-pix/tests/unit/routes/authenticated/user-tests-test.js index 8046e12b9e4..b0caea1c5dc 100644 --- a/mon-pix/tests/unit/routes/authenticated/user-tests-test.js +++ b/mon-pix/tests/unit/routes/authenticated/user-tests-test.js @@ -10,14 +10,14 @@ module('Unit | Route | User-Tests', function (hooks) { module('#model', function () { test('should returns the model that contains campaignParticipationOverviews', async function (assert) { // given - const currentUserStub = Service.create({ user: { id: 1 } }); + const currentUserStub = Service.create({ user: { id: '1' } }); const store = this.owner.lookup('service:store'); sinon.stub(store, 'query'); - const campaignParticipationOverviews = [EmberObject.create({ id: 10 })]; + const campaignParticipationOverviews = [EmberObject.create({ id: '10' })]; store.query .withArgs('campaign-participation-overview', { - userId: 1, + userId: '1', 'page[number]': 1, 'page[size]': 100, 'filter[states]': ['ONGOING', 'TO_SHARE', 'ENDED', 'DISABLED'], @@ -49,7 +49,7 @@ module('Unit | Route | User-Tests', function (hooks) { test('should continue on user-tests if there is some campaign participations', function (assert) { const route = this.owner.lookup('route:authenticated/user-tests'); sinon.stub(route.router, 'replaceWith'); - const campaignParticipationOverviews = [EmberObject.create({ id: 10 })]; + const campaignParticipationOverviews = [EmberObject.create({ id: '10' })]; route.redirect(campaignParticipationOverviews, {}); sinon.assert.notCalled(route.router.replaceWith); diff --git a/mon-pix/tests/unit/routes/campaigns/assessment/results.js b/mon-pix/tests/unit/routes/campaigns/assessment/results.js index d65261ccd5c..7e3a2371e43 100644 --- a/mon-pix/tests/unit/routes/campaigns/assessment/results.js +++ b/mon-pix/tests/unit/routes/campaigns/assessment/results.js @@ -6,10 +6,10 @@ module('Unit | Route | Campaign | Assessment | Results', function (hooks) { setupTest(hooks); let route; - const campaign = { id: 123456, code: 'NEW_CODE' }; + const campaign = { id: '123456', code: 'NEW_CODE' }; const questResults = [{ obtained: true, reward: { key: 'reward-key' } }]; - const campaignParticipation = { id: 1212, isShared: true, hasMany: sinon.stub() }; - const user = { id: 567890 }; + const campaignParticipation = { id: '1212', isShared: true, hasMany: sinon.stub() }; + const user = { id: '567890' }; const storeStub = { queryRecord: sinon.stub(), query: sinon.stub(), diff --git a/mon-pix/tests/unit/routes/campaigns/entry-point-test.js b/mon-pix/tests/unit/routes/campaigns/entry-point-test.js index 8b246e03aba..8aa2b3e6b82 100644 --- a/mon-pix/tests/unit/routes/campaigns/entry-point-test.js +++ b/mon-pix/tests/unit/routes/campaigns/entry-point-test.js @@ -11,7 +11,7 @@ module('Unit | Route | Entry Point', function (hooks) { hooks.beforeEach(function () { campaign = EmberObject.create({ - id: 3, + id: '3', code: 'NEW_CODE', isAccessible: true, }); @@ -121,7 +121,7 @@ module('Unit | Route | Entry Point', function (hooks) { module('user connected', function (hooks) { hooks.beforeEach(function () { - route.currentUser = { user: { id: 12 } }; + route.currentUser = { user: { id: '12' } }; route.session.isAuthenticated = true; }); @@ -131,8 +131,8 @@ module('Unit | Route | Entry Point', function (hooks) { //then sinon.assert.calledWith(route.store.queryRecord, 'campaign-participation', { - campaignId: 3, - userId: 12, + campaignId: '3', + userId: '12', }); assert.ok(true); }); @@ -176,8 +176,8 @@ module('Unit | Route | Entry Point', function (hooks) { //given route.store.queryRecord .withArgs('campaign-participation', { - campaignId: 3, - userId: 12, + campaignId: '3', + userId: '12', }) .resolves('Ma Participation'); @@ -215,8 +215,8 @@ module('Unit | Route | Entry Point', function (hooks) { //given route.store.queryRecord .withArgs('campaign-participation', { - campaignId: 3, - userId: 12, + campaignId: '3', + userId: '12', }) .resolves('Ma Participation'); @@ -237,7 +237,7 @@ module('Unit | Route | Entry Point', function (hooks) { transition = { to: { queryParams: { participantExternalId: 'externalId' } } }; route.currentUser = { user: { - id: 12, + id: '12', }, }; @@ -254,7 +254,7 @@ module('Unit | Route | Entry Point', function (hooks) { transition = { to: { queryParams: { externalId: 'externalId' } } }; route.currentUser = { user: { - id: 12, + id: '12', }, }; @@ -273,7 +273,7 @@ module('Unit | Route | Entry Point', function (hooks) { const transition = { to: { queryParams: {} } }; route.currentUser = { user: { - id: 12, + id: '12', }, }; @@ -294,7 +294,7 @@ module('Unit | Route | Entry Point', function (hooks) { const transition = { to: { queryParams: { retry: 'true' } } }; route.currentUser = { user: { - id: 12, + id: '12', }, }; @@ -313,7 +313,7 @@ module('Unit | Route | Entry Point', function (hooks) { const transition = { to: { queryParams: {} } }; route.currentUser = { user: { - id: 12, + id: '12', }, }; diff --git a/mon-pix/tests/unit/routes/campaigns/profiles-collection/profile-already-shared-test.js b/mon-pix/tests/unit/routes/campaigns/profiles-collection/profile-already-shared-test.js index 1deb82842a9..6e4a105ccbd 100644 --- a/mon-pix/tests/unit/routes/campaigns/profiles-collection/profile-already-shared-test.js +++ b/mon-pix/tests/unit/routes/campaigns/profiles-collection/profile-already-shared-test.js @@ -6,8 +6,8 @@ module('Unit | Route | Campaign | Profiles Collection | Profile already shared', setupTest(hooks); let route; - const campaign = { id: 123456, code: 'NEW_CODE' }; - const user = { id: 567890 }; + const campaign = { id: '123456', code: 'NEW_CODE' }; + const user = { id: '567890' }; const storeStub = { queryRecord: sinon.stub(), }; @@ -38,7 +38,7 @@ module('Unit | Route | Campaign | Profiles Collection | Profile already shared', module('when participation exists', function (hooks) { hooks.beforeEach(function () { storeStub.queryRecord - .withArgs('sharedProfileForCampaign', { campaignId: campaign.id, userId: user.id }) + .withArgs('shared-profile-for-campaign', { campaignId: campaign.id, userId: user.id }) .resolves(campaign); }); diff --git a/mon-pix/tests/unit/routes/courses/start-test.js b/mon-pix/tests/unit/routes/courses/start-test.js index a40ba5d21aa..ea986e7963f 100644 --- a/mon-pix/tests/unit/routes/courses/start-test.js +++ b/mon-pix/tests/unit/routes/courses/start-test.js @@ -14,8 +14,8 @@ module('Unit | Route | Courses | Start', function (hooks) { let createdAssessment; hooks.beforeEach(function () { - course = EmberObject.create({ id: 1, type: 'DEMO' }); - createdAssessment = EmberObject.create({ id: 1234 }); + course = EmberObject.create({ id: '1', type: 'DEMO' }); + createdAssessment = EmberObject.create({ id: '1234' }); createRecordStub = sinon.stub().returns({ save: sinon.stub().resolves(createdAssessment), }); diff --git a/mon-pix/tests/unit/routes/reset-password-test.js b/mon-pix/tests/unit/routes/reset-password-test.js index 9d1e22d9869..6d3ed57b9df 100644 --- a/mon-pix/tests/unit/routes/reset-password-test.js +++ b/mon-pix/tests/unit/routes/reset-password-test.js @@ -54,7 +54,7 @@ module('Unit | Route | reset-password', function (hooks) { // given const fetchedOwnerDetails = { data: { - id: 7, + id: '7', attributes: { email: 'pix@qmail.fr', }, @@ -62,7 +62,7 @@ module('Unit | Route | reset-password', function (hooks) { }; const expectedUser = { data: { - id: 7, + id: '7', attributes: { email: 'pix@qmail.fr', }, diff --git a/mon-pix/tests/unit/services/current-user-test.js b/mon-pix/tests/unit/services/current-user-test.js index d20dfd718b1..2714729c33d 100644 --- a/mon-pix/tests/unit/services/current-user-test.js +++ b/mon-pix/tests/unit/services/current-user-test.js @@ -10,7 +10,7 @@ module('Unit | Service | current-user', function (hooks) { let sessionStub; module('user is authenticated', function (hooks) { - const user = { id: 1 }; + const user = { id: '1' }; hooks.beforeEach(function () { sessionStub = Service.create({ isAuthenticated: true }); storeStub = Service.create({ diff --git a/mon-pix/tests/unit/services/focused-certification-challenge-warning-manager-test.js b/mon-pix/tests/unit/services/focused-certification-challenge-warning-manager-test.js index b64c1314e68..f9797893aeb 100644 --- a/mon-pix/tests/unit/services/focused-certification-challenge-warning-manager-test.js +++ b/mon-pix/tests/unit/services/focused-certification-challenge-warning-manager-test.js @@ -5,26 +5,20 @@ import sinon from 'sinon'; module('Unit | Service | focused-certification-challenge-warning-manager', function (hooks) { setupTest(hooks); - const originalGetItem = window.localStorage.getItem; - const originalSetItem = window.localStorage.setItem; - const originalRemoveItem = window.localStorage.removeItem; + let getItemStub; hooks.beforeEach(function () { - window.localStorage.getItem = sinon.stub(); - window.localStorage.setItem = sinon.stub(); - window.localStorage.removeItem = sinon.stub(); + getItemStub = sinon.stub(window.localStorage, 'getItem'); }); hooks.afterEach(function () { - window.localStorage.getItem = originalGetItem; - window.localStorage.setItem = originalSetItem; - window.localStorage.removeItem = originalRemoveItem; + sinon.restore(); }); module('#setToConfirmed', function () { test('should set to true', function (assert) { // given - window.localStorage.getItem.withArgs('hasConfirmedFocusChallengeScreen').returns(false); + getItemStub.withArgs('hasConfirmedFocusChallengeScreen').returns(false); const service = this.owner.lookup('service:focused-certification-challenge-warning-manager'); // when @@ -38,7 +32,7 @@ module('Unit | Service | focused-certification-challenge-warning-manager', funct module('#hasConfirmed', function () { test('should return true when hasConfirmedFocusChallengeScreen is true in localstorage', function (assert) { // given - window.localStorage.getItem.withArgs('hasConfirmedFocusChallengeScreen').returns(true); + getItemStub.withArgs('hasConfirmedFocusChallengeScreen').returns(true); const service = this.owner.lookup('service:focused-certification-challenge-warning-manager'); // when // then @@ -47,7 +41,7 @@ module('Unit | Service | focused-certification-challenge-warning-manager', funct test('should return false when when hasConfirmedFocusChallengeScreen is false in localstorage', function (assert) { // given - window.localStorage.getItem.withArgs('hasConfirmedFocusChallengeScreen').returns(false); + getItemStub.withArgs('hasConfirmedFocusChallengeScreen').returns(false); const service = this.owner.lookup('service:focused-certification-challenge-warning-manager'); // when // then @@ -56,7 +50,7 @@ module('Unit | Service | focused-certification-challenge-warning-manager', funct test('should return false when hasConfirmedFocusChallengeScreen does not exist in local storage', function (assert) { // given - window.localStorage.getItem.withArgs('hasConfirmedFocusChallengeScreen').returns(null); + getItemStub.withArgs('hasConfirmedFocusChallengeScreen').returns(null); const service = this.owner.lookup('service:focused-certification-challenge-warning-manager'); // when // then @@ -67,7 +61,7 @@ module('Unit | Service | focused-certification-challenge-warning-manager', funct module('#reset', function () { test('should remove hasConfirmedFocusChallengeScreen from local storage', function (assert) { // given - window.localStorage.getItem.withArgs('hasConfirmedFocusChallengeScreen').returns(true); + getItemStub.withArgs('hasConfirmedFocusChallengeScreen').returns(true); const service = this.owner.lookup('service:focused-certification-challenge-warning-manager'); // when