Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stelios-CB committed Nov 11, 2024
1 parent f2b77e4 commit 870a863
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,5 @@
}
]
},
"generated_at": "2024-11-08T15:10:58Z"
"generated_at": "2024-11-11T16:31:44Z"
}
16 changes: 8 additions & 8 deletions src/services/VerifyAccountRequestProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ export class VerifyAccountRequestProcessor {
evidence: [
{
txn: verifyResponse.expRequestId,
attemptNum: session.attemptCount ?? 1,
},
],
},
restricted: {
Experian_request_details: [
{
name: getFullName(person.name),
sortCode: verifyAccountPayload?.sort_code,
accountNumber: verifyAccountPayload?.account_number,
attemptNum: session.attemptCount ?? 1,
},
],
name: person.name,
birthDate: person.birthDate,
bankAccount: [{
sortCode: verifyAccountPayload?.sort_code,
accountNumber: verifyAccountPayload?.account_number,
}],
},
}, encodedHeader);


await this.BavService.sendToTXMA(this.txmaQueueUrl, {
event_name: TxmaEventNames.BAV_EXPERIAN_RESPONSE_RECEIVED,
Expand Down
21 changes: 20 additions & 1 deletion src/tests/unit/utils/PersonIdentityUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ describe("PersonIdentityUtils", () => {
expect(result).toBe("First");
});

it("returns middle names", () => {

it("returns middle name", () => {
const result = getMiddleNames([{ nameParts: [
{ type: "GivenName", value: "First" },
{ type: "GivenName", value: "Middle" },
{ type: "FamilyName", value: "Last" },
] }]);
expect(result).toBe("Middle");
});

it("returns multiple middle names", () => {
const result = getMiddleNames([{ nameParts: [
{ type: "GivenName", value: "First" },
{ type: "GivenName", value: "MiddleOne" },
Expand All @@ -30,6 +40,15 @@ describe("PersonIdentityUtils", () => {
expect(result).toBe("MiddleOne MiddleTwo");
});

it("returns empty string if no middle names provided", () => {
const result = getMiddleNames([{ nameParts: [
{ type: "GivenName", value: "First" },
{ type: "GivenName", value: "" },
{ type: "FamilyName", value: "Last" },
] }]);
expect(result).toBe("");
});

it("returns last name", () => {
const result = getLastName([{ nameParts: [
{ type: "GivenName", value: "First" },
Expand Down

0 comments on commit 870a863

Please sign in to comment.