From bd43f7a7ed240f0b4b1baeedb6f6897638757969 Mon Sep 17 00:00:00 2001 From: Alexandre-Monney <101280231+Alexandre-Monney@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:37:25 +0100 Subject: [PATCH] =?UTF-8?q?[TECH]=20D=C3=A9finir=20la=20locale=20a=20FRENC?= =?UTF-8?q?H=20dans=20le=20cas=20des=20attestations=20(PIX-14836)=20(#1053?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/profile/application/attestation-controller.js | 4 +++- .../profile/unit/application/attestation-controller_test.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/profile/application/attestation-controller.js b/api/src/profile/application/attestation-controller.js index fe3821086ef..a9454af52c6 100644 --- a/api/src/profile/application/attestation-controller.js +++ b/api/src/profile/application/attestation-controller.js @@ -2,6 +2,7 @@ import * as path from 'node:path'; import * as url from 'node:url'; import * as requestResponseUtils from '../../../src/shared/infrastructure/utils/request-response-utils.js'; +import { LOCALE } from '../../shared/domain/constants.js'; import { usecases } from '../domain/usecases/index.js'; import * as pdfWithFormSerializer from '../infrastructure/serializers/pdf/pdf-with-form-serializer.js'; @@ -9,8 +10,9 @@ const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); const getUserAttestation = async function (request, h, dependencies = { pdfWithFormSerializer, requestResponseUtils }) { const userId = request.params.userId; - const locale = dependencies.requestResponseUtils.extractLocaleFromRequest(request); const attestationKey = request.params.attestationKey; + + const locale = LOCALE.FRENCH_FRANCE; const { data, templateName } = await usecases.getAttestationDataForUsers({ attestationKey, userIds: [userId], diff --git a/api/tests/profile/unit/application/attestation-controller_test.js b/api/tests/profile/unit/application/attestation-controller_test.js index ea0b1bfbaf4..7358f77d1c3 100644 --- a/api/tests/profile/unit/application/attestation-controller_test.js +++ b/api/tests/profile/unit/application/attestation-controller_test.js @@ -1,5 +1,6 @@ import { attestationController } from '../../../../src/profile/application/attestation-controller.js'; import { usecases } from '../../../../src/profile/domain/usecases/index.js'; +import { LOCALE } from '../../../../src/shared/domain/constants.js'; import * as requestResponseUtils from '../../../../src/shared/infrastructure/utils/request-response-utils.js'; import { expect, hFake, sinon } from '../../../test-helper.js'; @@ -10,7 +11,7 @@ describe('Profile | Unit | Controller | attestation-controller', function () { const pdfWithFormSerializerStub = { serialize: sinon.stub() }; sinon.stub(usecases, 'getAttestationDataForUsers'); const userId = '12'; - const locale = 'fr'; + const locale = LOCALE.FRENCH_FRANCE; const attestationKey = 'key'; const request = {