Skip to content

Commit

Permalink
[TECH] Définir la locale a FRENCH dans le cas des attestations (PIX-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-Monney authored Nov 13, 2024
1 parent 157e39d commit bd43f7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/src/profile/application/attestation-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ 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';

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],
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 = {
Expand Down

0 comments on commit bd43f7a

Please sign in to comment.