diff --git a/src/us_street/Candidate.ts b/src/us_street/Candidate.ts index 5200518..1f3efff 100644 --- a/src/us_street/Candidate.ts +++ b/src/us_street/Candidate.ts @@ -178,6 +178,7 @@ export interface RawUsStreetCandidate { last_line?: string; delivery_point_barcode?: string; smarty_key?: string; + smarty_key_ext?: string; components?: RawUsStreetComponents; metadata?: RawUsStreetMetadata; analysis?: RawUsStreetAnalysis; @@ -193,6 +194,7 @@ export default class Candidate { lastLine: string; deliveryPointBarcode: string; smartyKey: string; + smartyKeyExt: string; components: UsStreetComponents; metadata: UsStreetMetadata; analysis: UsStreetAnalysis; @@ -207,6 +209,7 @@ export default class Candidate { this.lastLine = responseData.last_line ?? ""; this.deliveryPointBarcode = responseData.delivery_point_barcode ?? ""; this.smartyKey = responseData.smarty_key ?? ""; + this.smartyKeyExt = responseData.smarty_key_ext ?? ""; this.components = {} as UsStreetComponents; if (responseData.components !== undefined) { diff --git a/tests/us_street/test_Candidate.ts b/tests/us_street/test_Candidate.ts index b988283..401a561 100644 --- a/tests/us_street/test_Candidate.ts +++ b/tests/us_street/test_Candidate.ts @@ -12,6 +12,7 @@ describe("A match candidate", function () { last_line: "5", delivery_point_barcode: "6", smarty_key: "0000", + smarty_key_ext: "0", components: { urbanization: "7", primary_number: "8", @@ -96,6 +97,7 @@ describe("A match candidate", function () { expect(candidate.lastLine).to.equal("5"); expect(candidate.deliveryPointBarcode).to.equal("6"); expect(candidate.smartyKey).to.equal("0000"); + expect(candidate.smartyKeyExt).to.equal("0"); expect(candidate.components.urbanization).to.equal("7"); expect(candidate.components.primaryNumber).to.equal("8"); diff --git a/tests/us_street/test_Client.ts b/tests/us_street/test_Client.ts index 52f29e3..f8f3bcb 100644 --- a/tests/us_street/test_Client.ts +++ b/tests/us_street/test_Client.ts @@ -257,6 +257,17 @@ describe("A US Street client", function () { }); }); + it("maps smarty_key_ext from response to smartyKeyExt on candidate.", function () { + const expectedMockPayload = [{ smarty_key_ext: "0", input_index: 0 }]; + let mockSender = new MockSenderWithResponse(expectedMockPayload); + const client = new Client(mockSender); + let lookup = new Lookup(); + + return client.send(lookup).then((_response) => { + expect(lookup.result[0].smartyKeyExt).to.equal("0"); + }); + }); + it("attaches match candidates to their corresponding lookups.", function () { const expectedMockPayload = [ { delivery_line_1: "Address 0", input_index: 0 },