From 2eee60b1b7a425ca5d887e1f85f1c791ec9d7ba6 Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Mon, 20 Nov 2023 12:53:25 -0800 Subject: [PATCH 1/7] added dotenv to dev dependencies to run tests locally, added as import in existing tests --- package-lock.json | 19 +++++++++++++++++++ package.json | 3 ++- test/city-test.ts | 1 + test/validator-test.ts | 1 + test/zipcode-test.ts | 1 + 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 33e84cd..f5ea061 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@types/node": "^16.18.59", "ava": "^5.3.1", "c8": "^8.0.1", + "dotenv": "^16.3.1", "eslint": "^8.52.0", "prettier": "^3.0.3", "tsx": "^3.14.0", @@ -2452,6 +2453,18 @@ "node": ">=0.10.0" } }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -7854,6 +7867,12 @@ "esutils": "^2.0.2" } }, + "dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true + }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/package.json b/package.json index 7d732ec..d58d783 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@types/node": "^16.18.59", "ava": "^5.3.1", "c8": "^8.0.1", + "dotenv": "^16.3.1", "eslint": "^8.52.0", "prettier": "^3.0.3", "tsx": "^3.14.0", @@ -69,4 +70,4 @@ "overrides": { "eslint-plugin-import": "npm:eslint-plugin-i@2.28.1" } -} +} \ No newline at end of file diff --git a/test/city-test.ts b/test/city-test.ts index 4ab2dda..8a103a9 100644 --- a/test/city-test.ts +++ b/test/city-test.ts @@ -1,4 +1,5 @@ import test from "ava"; +import 'dotenv/config' import type { CityStateLookupResponse } from "../src/lookups/city-state-lookup.js"; import USPS from "../src/usps.js"; diff --git a/test/validator-test.ts b/test/validator-test.ts index b67f588..d73635a 100644 --- a/test/validator-test.ts +++ b/test/validator-test.ts @@ -1,6 +1,7 @@ /* eslint-disable sonarjs/no-duplicate-string */ import test from "ava"; +import "dotenv/config"; import USPS from "../src/usps.js"; diff --git a/test/zipcode-test.ts b/test/zipcode-test.ts index 0ac6825..0b107cb 100644 --- a/test/zipcode-test.ts +++ b/test/zipcode-test.ts @@ -1,4 +1,5 @@ import test from "ava"; +import 'dotenv/config' import USPS, { type Address } from "../src/usps.js"; From b0550e840c06108f9cd7258c5d1b3fcedc809ea2 Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Mon, 20 Nov 2023 13:07:53 -0800 Subject: [PATCH 2/7] imported and added more types to the 'parameters' param --- src/utils/request.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/request.ts b/src/utils/request.ts index a1351f4..c68f969 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -10,6 +10,9 @@ import type { AddressValidateRequest, AddressValidateResponse, } from "../address-validate.js"; +import type { + MultipleAddressValidateRequest, +} from "../multiple-address-validate.js"; import type { CityStateLookupRequest, CityStateLookupResponse, @@ -72,6 +75,7 @@ export default async ( config: Config, parameters: | AddressValidateRequest + | MultipleAddressValidateRequest | ZipCodeLookupRequest | CityStateLookupRequest | RateV4Request, From 57ae6809f73911cff050ca07e427c4f5b9460662 Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Mon, 20 Nov 2023 13:09:41 -0800 Subject: [PATCH 3/7] implemented function to handle list of up to 5 addresses and wrote tests for it --- src/multiple-address-validate.ts | 83 ++++++++++++++++++++++ test/multiple-validator-test.ts | 117 +++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 src/multiple-address-validate.ts create mode 100644 test/multiple-validator-test.ts diff --git a/src/multiple-address-validate.ts b/src/multiple-address-validate.ts new file mode 100644 index 0000000..55fb5cd --- /dev/null +++ b/src/multiple-address-validate.ts @@ -0,0 +1,83 @@ +import type { Address, MultipleAddress } from "./usps.js"; +import type USPSClass from "./usps.js"; +import type { AddressValidateResponse } from "./address-validate.js"; +import properCase from "./utils/proper-case.js"; +import callUSPS from "./utils/request.js"; + +// See page 4, "AddressValidateRequest / Address /" section of: https://www.usps.com/business/web-tools-apis/address-information-api.pdf + +export interface MultipleAddressValidateRequest { + Address: MultipleAddress[]; + Revision: number; +} + +// eslint-disable-next-line sonarjs/cognitive-complexity, func-names +export default async function ( + this: USPSClass, + addresses: Address[], +): Promise { + if (addresses.length > 5) { + throw new Error("Maximum of 5 addresses allowed per request.") + } + + if (Array.isArray(addresses) === false) { + throw new Error("Must pass an array of addresses. For single address use 'verify' method."); + } + + const Addresses: MultipleAddress[] = addresses.map((address: Address, index: number) => ({ + '@ID': index.toString(), + Address1: address.Address2 ?? "", + Address2: address.Address1 ?? "", + City: address.City ?? "", + State: address.State ?? "", + Urbanization: address.Urbanization ?? "", + Zip5: address.Zip5 ?? "", + // USPS expects Zip4 after Zip5 + // eslint-disable-next-line sort-keys + Zip4: address.Zip4 ?? "", + })); + + const parameters: MultipleAddressValidateRequest = { + Revision: 1, + Address: Addresses, + }; + + let response: AddressValidateResponse[]; + try { + response = (await callUSPS( + "Verify", + "AddressValidate", + "Address", + this.config, + parameters, + )) as AddressValidateResponse[]; + if (response) { + const addresses = response.map((addr) => { + const switchAddresses = addr.Address1; + addr.Address1 = addr.Address2; + addr.Address2 = switchAddresses; + if (this.config.properCase) { + addr.Address1 = addr.Address1 + ? properCase(addr.Address1) + : undefined; + addr.Address2 = addr.Address2 + ? properCase(addr.Address2) + : undefined; + addr.City = addr.City ? properCase(addr.City) : undefined; + addr.FirmName = addr.FirmName + ? properCase(addr.FirmName) + : undefined; + } + addr.Zip4 = + typeof addr.Zip4 === "object" + ? undefined + : addr.Zip4?.toString(); + return addr as MultipleAddress; + }) + return addresses; + } + throw new Error("Can't find results"); + } catch (error) { + throw new Error(error as string); + } +} diff --git a/test/multiple-validator-test.ts b/test/multiple-validator-test.ts new file mode 100644 index 0000000..6965676 --- /dev/null +++ b/test/multiple-validator-test.ts @@ -0,0 +1,117 @@ +/* eslint-disable sonarjs/no-duplicate-string */ + +import test from "ava"; +import 'dotenv/config' + +import USPS from "../src/usps.js"; + +const usps = new USPS({ + userId: process.env["USPS_ID"]!, +}); + +const fourAddresses = [ + { + Address1: "11205 SE 233RD PL.", + Address2: "Apartment 2", + City: "Kent", + State: "WA", + Zip5: "98031", + }, + { + Address1: "11205 SE 233RD PL.", + Address2: "UNIT 2", + City: "Kent", + State: "WA", + Zip5: "98031", + }, + { + Address1: "11205 southeast 233Road PLace.", + Address2: "Building 2", + City: "Kent", + State: "WA", + Zip5: "98031", + }, + { + Address1: "11205 SE 233RD PL.", + Address2: "Floor 2", + City: "Kent", + State: "WA", + Zip5: "98031", + }, +]; + +const moreAddresses = [ + { + Address1: "11205 SE 233RD PL.", + Address2: "Apartment 4", + City: "Kent", + State: "WA", + Zip5: "98031", + }, + { + Address1: "11205 southeast 233Road PLace.", + Address2: "Building 3", + City: "Kent", + State: "WA", + Zip5: "98031", + }, +] + +const invalidAddress = { + Address1: "1212 s kingsway rd", + City: "seffner", + State: "fl", + Zip5: "33584", +} + +test("Multiple address verify should return the same number of addresses.", async (t) => { + const addresses = await usps.verifyMultiple(fourAddresses); + t.is(addresses.length, 4); +}); + +test("Multiple address verify should only accept addesses in an array.", async (t) => { + const error = await t.throwsAsync(async () => { + // @ts-expect-error + await usps.verifyMultiple(fourAddresses[0]); + }); + t.is( + error?.message, + "Must pass an array of addresses. For single address use 'verify' method.", + ); +}); + +test("Multiple address verify should throw an error if more than 5 addresses are passed.", async (t) => { + const error = await t.throwsAsync(async () => { + await usps.verifyMultiple([...fourAddresses, ...moreAddresses]); + }); + t.is( + error?.message, + "Maximum of 5 addresses allowed per request.", + ); +}); + +test("Multiple address verify should validate each address in the same way as a single verify would.", async (t) => { + const addresses = await usps.verifyMultiple(fourAddresses); + t.is(addresses[0]?.Address2, "APT 2"); + t.is(addresses[1]?.Address2, "UNIT 2"); + t.is(addresses[2]?.Address2, "BLDG 2"); + t.is(addresses[3]?.Address2, "FL 2"); +}); + +test("Multiple address verify should handle proper case the same as single verify.", async (t) => { + const uspsCase = new USPS({ + properCase: true, + userId: process.env["USPS_ID"]!, + }); + const addresses = await uspsCase.verifyMultiple(moreAddresses); + t.is(addresses[0]?.Address1, "11205 SE 233rd Pl"); + t.is(addresses[0]?.Address2, "Apt 4"); + t.is(addresses[0]?.City, "Kent"); +}); + +test("Multiple address verify should contain error message for any unverifiable addresses in a list.", async (t) => { + const addresses = await usps.verifyMultiple([...moreAddresses, invalidAddress]); + t.false(addresses[0]?.hasOwnProperty("Error")); + t.false(addresses[1]?.hasOwnProperty("Error")); + t.is(addresses[2]?.Error?.Description, "Multiple addresses were found for the information you entered, and no default exists."); +}); \ No newline at end of file From 016aa91beb67cedc613d6cc7c60d455503c5a94b Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Mon, 20 Nov 2023 13:12:02 -0800 Subject: [PATCH 4/7] created interface for addresses that are part of a list, extending Address. Added new method to usps --- src/usps.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/usps.ts b/src/usps.ts index c26df12..45c0867 100644 --- a/src/usps.ts +++ b/src/usps.ts @@ -1,4 +1,5 @@ import verify from "./address-validate.js"; +import verifyMultiple from "./multiple-address-validate.js" import cityStateLookup from "./lookups/city-state-lookup.js"; import pricingRateLookup from "./lookups/pricing-rate-lookup.js"; import zipCodeLookup from "./lookups/zip-code-lookup.js"; @@ -28,6 +29,13 @@ export interface Address { Zip5?: string; } +// Each address needs an ID when sending multiple in a single request +// Error can be returned for each address +export interface MultipleAddress extends Address { + "@ID": string; + Error?: ErrorResponse; +} + export default class { public cityStateLookup = cityStateLookup; @@ -46,5 +54,7 @@ export default class { public verify = verify; + public verifyMultiple = verifyMultiple; + public zipCodeLookup = zipCodeLookup; } From 6acf8302ac17030bb4fe1ab8b150f760de20bd07 Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Mon, 20 Nov 2023 13:13:06 -0800 Subject: [PATCH 5/7] updated readme to reflect addition of verifyMultiple and updated c8 coverage output --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 75e15d0..8904cc6 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,35 @@ const usps = new USPS({ }); ``` +### verifyMultiple(object[]) + +Verify takes one parameter: object[] + +object[]: [{Address1, Address2, City, State, Zip}] + +**Example** + +```js +usps + .verifyMultiple([{ + Address1: "322 3rd st.", + Address2: "Apt 2", + City: "San Francisco", + State: "CA", + Zip5: "94103", + }, { + Address1: "322 3rd st.", + Address2: "Apt 2", + City: "San Francisco", + State: "CA", + Zip5: "94103", + } + ]) + .then((address) => { + console.log(address); + }); +``` + ### verify(object) Verify takes one parameter: object @@ -88,19 +117,20 @@ console.log(result); ### Coverage ``` --------------------------|---------|----------|---------|---------|---------------------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s --------------------------|---------|----------|---------|---------|---------------------------------- -All files | 91.78 | 59.61 | 87.5 | 91.78 | - src | 99.32 | 47.36 | 100 | 99.32 | - address-validate.ts | 98.97 | 33.33 | 100 | 98.97 | 94 - usps.ts | 100 | 100 | 100 | 100 | - src/lookups | 85.55 | 60 | 66.66 | 85.55 | - city-state-lookup.ts | 97.95 | 80 | 100 | 97.95 | 45 - pricing-rate-lookup.ts | 75.16 | 100 | 0 | 75.16 | 113-149 - zip-code-lookup.ts | 98.61 | 50 | 100 | 98.61 | 68 - src/utils | 94.58 | 72.22 | 100 | 94.58 | - proper-case.ts | 97.95 | 100 | 100 | 97.95 | 36 - request.ts | 93.5 | 61.53 | 100 | 93.5 | 48-49,55,115-116,120-122,153-154 --------------------------|---------|----------|---------|---------|---------------------------------- +-------------------------------|---------|----------|---------|---------|------------------------------ +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +-------------------------------|---------|----------|---------|---------|------------------------------ +All files | 91.64 | 62.65 | 93.75 | 91.64 | + src | 95.85 | 55.55 | 100 | 95.85 | + address-validate.ts | 96 | 37.5 | 100 | 96 | 81,84,87,93 + multiple-address-validate.ts | 92.77 | 54.54 | 100 | 92.77 | 62,65,68,80-82 + usps.ts | 100 | 100 | 100 | 100 | + src/lookups | 84.81 | 66.66 | 83.33 | 84.81 | + city-state-lookup.ts | 100 | 83.33 | 100 | 100 | 45 + pricing-rate-lookup.ts | 74.49 | 100 | 50 | 74.49 | 112-149 + zip-code-lookup.ts | 95.83 | 54.54 | 100 | 95.83 | 57,60,63 + src/utils | 95.65 | 75 | 100 | 95.65 | + proper-case.ts | 100 | 100 | 100 | 100 | + request.ts | 94.23 | 64.28 | 100 | 94.23 | 54-55,61,112,122-123,127-129 +-------------------------------|---------|----------|---------|---------|------------------------------ ``` From 4f825f03c6c13e1a9aab6fa4d98091c119bfdd93 Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Fri, 1 Dec 2023 15:58:13 -0800 Subject: [PATCH 6/7] removed dotenv from dev deps and references to it in tests bc it was likely interfering with github secrets --- package-lock.json | 19 ------------------- package.json | 3 +-- test/city-test.ts | 1 - test/multiple-validator-test.ts | 2 -- test/validator-test.ts | 2 -- test/zipcode-test.ts | 1 - 6 files changed, 1 insertion(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5ea061..33e84cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ "@types/node": "^16.18.59", "ava": "^5.3.1", "c8": "^8.0.1", - "dotenv": "^16.3.1", "eslint": "^8.52.0", "prettier": "^3.0.3", "tsx": "^3.14.0", @@ -2453,18 +2452,6 @@ "node": ">=0.10.0" } }, - "node_modules/dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -7867,12 +7854,6 @@ "esutils": "^2.0.2" } }, - "dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", - "dev": true - }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/package.json b/package.json index d58d783..7d732ec 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "@types/node": "^16.18.59", "ava": "^5.3.1", "c8": "^8.0.1", - "dotenv": "^16.3.1", "eslint": "^8.52.0", "prettier": "^3.0.3", "tsx": "^3.14.0", @@ -70,4 +69,4 @@ "overrides": { "eslint-plugin-import": "npm:eslint-plugin-i@2.28.1" } -} \ No newline at end of file +} diff --git a/test/city-test.ts b/test/city-test.ts index 8a103a9..4ab2dda 100644 --- a/test/city-test.ts +++ b/test/city-test.ts @@ -1,5 +1,4 @@ import test from "ava"; -import 'dotenv/config' import type { CityStateLookupResponse } from "../src/lookups/city-state-lookup.js"; import USPS from "../src/usps.js"; diff --git a/test/multiple-validator-test.ts b/test/multiple-validator-test.ts index 6965676..2211153 100644 --- a/test/multiple-validator-test.ts +++ b/test/multiple-validator-test.ts @@ -1,7 +1,5 @@ /* eslint-disable sonarjs/no-duplicate-string */ - import test from "ava"; -import 'dotenv/config' import USPS from "../src/usps.js"; diff --git a/test/validator-test.ts b/test/validator-test.ts index d73635a..acad3b6 100644 --- a/test/validator-test.ts +++ b/test/validator-test.ts @@ -1,7 +1,5 @@ /* eslint-disable sonarjs/no-duplicate-string */ - import test from "ava"; -import "dotenv/config"; import USPS from "../src/usps.js"; diff --git a/test/zipcode-test.ts b/test/zipcode-test.ts index 0b107cb..0ac6825 100644 --- a/test/zipcode-test.ts +++ b/test/zipcode-test.ts @@ -1,5 +1,4 @@ import test from "ava"; -import 'dotenv/config' import USPS, { type Address } from "../src/usps.js"; From 1ec9039020dc516057a633913c8bcb1d024df73d Mon Sep 17 00:00:00 2001 From: derek-watson14 Date: Thu, 7 Dec 2023 10:41:20 -0800 Subject: [PATCH 7/7] Fixed linting errors and warnings --- src/multiple-address-validate.ts | 39 +++++++++++++++++--------------- test/multiple-validator-test.ts | 6 ++--- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/multiple-address-validate.ts b/src/multiple-address-validate.ts index 55fb5cd..1551080 100644 --- a/src/multiple-address-validate.ts +++ b/src/multiple-address-validate.ts @@ -21,7 +21,7 @@ export default async function ( } if (Array.isArray(addresses) === false) { - throw new Error("Must pass an array of addresses. For single address use 'verify' method."); + throw new TypeError("Must pass an array of addresses. For single address use 'verify' method."); } const Addresses: MultipleAddress[] = addresses.map((address: Address, index: number) => ({ @@ -39,6 +39,8 @@ export default async function ( const parameters: MultipleAddressValidateRequest = { Revision: 1, + // USPS expects Address to come after Revision + // eslint-disable-next-line sort-keys Address: Addresses, }; @@ -52,29 +54,30 @@ export default async function ( parameters, )) as AddressValidateResponse[]; if (response) { - const addresses = response.map((addr) => { - const switchAddresses = addr.Address1; - addr.Address1 = addr.Address2; - addr.Address2 = switchAddresses; + return response.map((addr) => { + const fAddr = { ...addr }; + + const switchAddresses = fAddr.Address1; + fAddr.Address1 = fAddr.Address2; + fAddr.Address2 = switchAddresses; if (this.config.properCase) { - addr.Address1 = addr.Address1 - ? properCase(addr.Address1) + fAddr.Address1 = fAddr.Address1 + ? properCase(fAddr.Address1) : undefined; - addr.Address2 = addr.Address2 - ? properCase(addr.Address2) + fAddr.Address2 = fAddr.Address2 + ? properCase(fAddr.Address2) : undefined; - addr.City = addr.City ? properCase(addr.City) : undefined; - addr.FirmName = addr.FirmName - ? properCase(addr.FirmName) + fAddr.City = fAddr.City ? properCase(fAddr.City) : undefined; + fAddr.FirmName = fAddr.FirmName + ? properCase(fAddr.FirmName) : undefined; } - addr.Zip4 = - typeof addr.Zip4 === "object" + fAddr.Zip4 = + typeof fAddr.Zip4 === "object" ? undefined - : addr.Zip4?.toString(); - return addr as MultipleAddress; - }) - return addresses; + : fAddr.Zip4?.toString(); + return fAddr as MultipleAddress; + }); } throw new Error("Can't find results"); } catch (error) { diff --git a/test/multiple-validator-test.ts b/test/multiple-validator-test.ts index 2211153..7fef3e9 100644 --- a/test/multiple-validator-test.ts +++ b/test/multiple-validator-test.ts @@ -69,7 +69,7 @@ test("Multiple address verify should return the same number of addresses.", asyn test("Multiple address verify should only accept addesses in an array.", async (t) => { const error = await t.throwsAsync(async () => { - // @ts-expect-error + // @ts-expect-error Testing invalid input await usps.verifyMultiple(fourAddresses[0]); }); t.is( @@ -109,7 +109,7 @@ test("Multiple address verify should handle proper case the same as single verif test("Multiple address verify should contain error message for any unverifiable addresses in a list.", async (t) => { const addresses = await usps.verifyMultiple([...moreAddresses, invalidAddress]); - t.false(addresses[0]?.hasOwnProperty("Error")); - t.false(addresses[1]?.hasOwnProperty("Error")); + t.false("Error" in addresses[0]!); + t.false("Error" in addresses[1]!); t.is(addresses[2]?.Error?.Description, "Multiple addresses were found for the information you entered, and no default exists."); }); \ No newline at end of file