Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/us_autocomplete/Suggestion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface RawUsAutocompleteSuggestion {
smarty_key?: string;
entry_id?: string;
urbanization?: string;
street_line?: string;
secondary?: string;
city?: string;
Expand All @@ -13,6 +14,7 @@ export interface RawUsAutocompleteSuggestion {
export default class Suggestion {
smartyKey: string;
entryId: string;
urbanization: string;
streetLine: string;
secondary: string;
city: string;
Expand All @@ -24,6 +26,7 @@ export default class Suggestion {
constructor(responseData: RawUsAutocompleteSuggestion) {
this.smartyKey = responseData.smarty_key ?? "";
this.entryId = responseData.entry_id ?? "";
this.urbanization = responseData.urbanization ?? "";
this.streetLine = responseData.street_line ?? "";
this.secondary = responseData.secondary ?? "";
this.city = responseData.city ?? "";
Expand Down
1 change: 1 addition & 0 deletions tests/us_autocomplete/test_Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ describe("A US Autocomplete Client", function () {
const responseData = {
smarty_key: "z",
entry_id: "y",
urbanization: "urb",
street_line: "a",
secondary: "b",
city: "c",
Expand Down
3 changes: 3 additions & 0 deletions tests/us_autocomplete/test_Suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe("A US Autocomplete Suggestion", function () {
const mockSuggestion = {
smarty_key: "z",
entry_id: "y",
urbanization: "urb",
street_line: "a",
secondary: "b",
city: "c",
Expand All @@ -18,6 +19,7 @@ describe("A US Autocomplete Suggestion", function () {

expect(suggestion.smartyKey).to.equal("z");
expect(suggestion.entryId).to.equal("y");
expect(suggestion.urbanization).to.equal("urb");
expect(suggestion.streetLine).to.equal("a");
expect(suggestion.secondary).to.equal("b");
expect(suggestion.city).to.equal("c");
Expand All @@ -38,6 +40,7 @@ describe("A US Autocomplete Suggestion", function () {

expect(suggestion.smartyKey).to.equal("");
expect(suggestion.entryId).to.equal("");
expect(suggestion.urbanization).to.equal("");
expect(suggestion.entries).to.equal(0);
expect(suggestion.source).to.equal("");
});
Expand Down