Skip to content

Commit 68fb45e

Browse files
Added SmartyKeyEXT to us-street (#136)
1 parent be7d5bb commit 68fb45e

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/us_street/Candidate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export interface RawUsStreetCandidate {
178178
last_line?: string;
179179
delivery_point_barcode?: string;
180180
smarty_key?: string;
181+
smarty_key_ext?: string;
181182
components?: RawUsStreetComponents;
182183
metadata?: RawUsStreetMetadata;
183184
analysis?: RawUsStreetAnalysis;
@@ -193,6 +194,7 @@ export default class Candidate {
193194
lastLine: string;
194195
deliveryPointBarcode: string;
195196
smartyKey: string;
197+
smartyKeyExt: string;
196198
components: UsStreetComponents;
197199
metadata: UsStreetMetadata;
198200
analysis: UsStreetAnalysis;
@@ -207,6 +209,7 @@ export default class Candidate {
207209
this.lastLine = responseData.last_line ?? "";
208210
this.deliveryPointBarcode = responseData.delivery_point_barcode ?? "";
209211
this.smartyKey = responseData.smarty_key ?? "";
212+
this.smartyKeyExt = responseData.smarty_key_ext ?? "";
210213

211214
this.components = {} as UsStreetComponents;
212215
if (responseData.components !== undefined) {

tests/us_street/test_Candidate.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("A match candidate", function () {
1212
last_line: "5",
1313
delivery_point_barcode: "6",
1414
smarty_key: "0000",
15+
smarty_key_ext: "0",
1516
components: {
1617
urbanization: "7",
1718
primary_number: "8",
@@ -96,6 +97,7 @@ describe("A match candidate", function () {
9697
expect(candidate.lastLine).to.equal("5");
9798
expect(candidate.deliveryPointBarcode).to.equal("6");
9899
expect(candidate.smartyKey).to.equal("0000");
100+
expect(candidate.smartyKeyExt).to.equal("0");
99101

100102
expect(candidate.components.urbanization).to.equal("7");
101103
expect(candidate.components.primaryNumber).to.equal("8");

tests/us_street/test_Client.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ describe("A US Street client", function () {
257257
});
258258
});
259259

260+
it("maps smarty_key_ext from response to smartyKeyExt on candidate.", function () {
261+
const expectedMockPayload = [{ smarty_key_ext: "0", input_index: 0 }];
262+
let mockSender = new MockSenderWithResponse(expectedMockPayload);
263+
const client = new Client(mockSender);
264+
let lookup = new Lookup();
265+
266+
return client.send(lookup).then((_response) => {
267+
expect(lookup.result[0].smartyKeyExt).to.equal("0");
268+
});
269+
});
270+
260271
it("attaches match candidates to their corresponding lookups.", function () {
261272
const expectedMockPayload = [
262273
{ delivery_line_1: "Address 0", input_index: 0 },

0 commit comments

Comments
 (0)