Skip to content

Commit

Permalink
fix(backend): fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Jan 28, 2025
1 parent e4b8b34 commit 23d4eb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class UsagersController {
"telephone" | "email" | "contactByPhone"
> = {
telephone: {
countryCode: contactDetails.telephone.countryCode,
countryCode: contactDetails?.telephone?.countryCode ?? "fr",
numero: getPhoneString(contactDetails.telephone).replace(/\s+/g, ""),
},
contactByPhone: contactDetails.contactByPhone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ describe("UsagersService", () => {
fakeUsagerDto.dateNaissance = new Date();
fakeUsagerDto.villeNaissance = "Paris";
fakeUsagerDto.email = "[email protected]";
fakeUsagerDto.telephone = {
countryCode: "fr",
numero: null,
};

let context: AppTestContext;

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/usagers/services/usagers.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class UsagersService {
usager.customRef = `${usager.ref}`;

usager.telephone = {
countryCode: usagerDto.telephone.countryCode,
countryCode: usagerDto?.telephone?.countryCode ?? "fr",
numero: getPhoneString(usagerDto.telephone).replace(/\s+/g, ""),
};

Expand Down

0 comments on commit 23d4eb5

Please sign in to comment.