Skip to content

Commit

Permalink
fix: change the cases for to match the specs
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyKitchell committed May 3, 2022
1 parent 1ba4742 commit 1f3bac9
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 100 deletions.
8 changes: 4 additions & 4 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ try {
The Bulk verify endpoint from our Addresses Verification Api is used to verify a list of US or US territory addresses with a live API key. This endpoint is not supported in lob-node but it is supported by the TypeScript SDK. This is how it is done:

```typescript
const UsVerifications = new USVerificationsApi(av_config);
const UsVerifications = new UsVerificationsApi(av_config);
const verificationData1: UsVerificationsWritable = {
primary_line: "001 CEMETERY LANE",
city: "WESTFIELD",
Expand All @@ -220,7 +220,7 @@ try {
​Again, as mentioned above, If you are using the new TypeScript SDK using JavaScript,the code is essentially the same apart from removing the type identifiers found in TypeScript This pattern may be followed for all methods where examples are not supplied as shown here:

```javascript
const UsVerifications = new USVerificationsApi(av_config);
const UsVerifications = new UsVerificationsApi(av_config);
const verificationData1 = {
primary_line: "001 CEMETERY LANE",
city: "WESTFIELD",
Expand Down Expand Up @@ -249,7 +249,7 @@ try {
Here is a sample of the lob-node SINGLE VERIFY method:

```javascript
Lob.usVerifications.verify({
Lob.UsVerifications.verify({
primary_line: '1313 CEMETERY LN',
city: 'WESTFIELD',
state: 'NJ',
Expand All @@ -262,7 +262,7 @@ Here is a sample of the lob-node SINGLE VERIFY method:
​Here is a sample of the TypeScript SDK Single Verify method:

```typescript
const UsVerifications = new USVerificationsApi(av_config);
const UsVerifications = new UsVerificationsApi(av_config);
const verificationData1: UsVerificationsWritable = {
primary_line: "001 CEMETERY LANE",
city: "WESTFIELD",
Expand Down
12 changes: 6 additions & 6 deletions __tests__/UsAutocompletionsApi.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { UsAutocompletionsWritable } from "../models";
import { USAutocompletionsApi } from "../api";
import { UsAutocompletionsApi } from "../api";
import { CONFIG_FOR_INTEGRATION_WITH_LIVE } from "./testFixtures";

describe("USAutocompletionsApi", () => {
describe("UsAutocompletionsApi", () => {
const autocompletionInput: UsAutocompletionsWritable = {
address_prefix: "1313",
city: "WESTFIELD",
Expand All @@ -12,25 +12,25 @@ describe("USAutocompletionsApi", () => {
};

it("US Autocompletions API can be instantiated", () => {
const autocompletionApi = new USAutocompletionsApi(
const autocompletionApi = new UsAutocompletionsApi(
CONFIG_FOR_INTEGRATION_WITH_LIVE
);
expect(autocompletionApi).toBeDefined();
expect(typeof autocompletionApi).toEqual("object");
expect(autocompletionApi).toBeInstanceOf(USAutocompletionsApi);
expect(autocompletionApi).toBeInstanceOf(UsAutocompletionsApi);
});

describe("autocomplete", () => {
it("exists", () => {
const autocompletionApi = new USAutocompletionsApi(
const autocompletionApi = new UsAutocompletionsApi(
CONFIG_FOR_INTEGRATION_WITH_LIVE
);
expect(autocompletionApi.autocomplete).toBeDefined();
expect(typeof autocompletionApi.autocomplete).toEqual("function");
});

it("autocompletes given input", async () => {
const response = await new USAutocompletionsApi(
const response = await new UsAutocompletionsApi(
CONFIG_FOR_INTEGRATION_WITH_LIVE
).autocomplete(autocompletionInput);
expect(response.suggestions).toBeDefined();
Expand Down
26 changes: 13 additions & 13 deletions __tests__/UsAutocompletionsApi.unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UsAutocompletionsWritable } from "../models";
import { USAutocompletionsApi } from "../api";
import { UsAutocompletionsApi } from "../api";

import { fail } from "./testUtilities";
import {
Expand All @@ -14,21 +14,21 @@ jest.mock("axios", () => ({
request: jest.fn(),
}));

describe("USAutocompletionsApi", () => {
describe("UsAutocompletionsApi", () => {
it("US Autocompletions API can be instantiated", () => {
const autocompletionApi = new USAutocompletionsApi(CONFIG_FOR_UNIT);
const autocompletionApi = new UsAutocompletionsApi(CONFIG_FOR_UNIT);
expect(autocompletionApi).toBeDefined();
expect(typeof autocompletionApi).toEqual("object");
expect(autocompletionApi).toBeInstanceOf(USAutocompletionsApi);
expect(autocompletionApi).toBeInstanceOf(UsAutocompletionsApi);
});

it("US Autocompletions API can be instantiated with base options", () => {
const autocompletionApi = new USAutocompletionsApi(
const autocompletionApi = new UsAutocompletionsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
);
expect(autocompletionApi).toBeDefined();
expect(typeof autocompletionApi).toEqual("object");
expect(autocompletionApi).toBeInstanceOf(USAutocompletionsApi);
expect(autocompletionApi).toBeInstanceOf(UsAutocompletionsApi);
});

describe("autocomplete", () => {
Expand All @@ -41,7 +41,7 @@ describe("USAutocompletionsApi", () => {
};

it("exists", () => {
const autocompletionApi = new USAutocompletionsApi(CONFIG_FOR_UNIT);
const autocompletionApi = new UsAutocompletionsApi(CONFIG_FOR_UNIT);
expect(autocompletionApi.autocomplete).toBeDefined();
expect(typeof autocompletionApi.autocomplete).toEqual("function");
});
Expand All @@ -55,7 +55,7 @@ describe("USAutocompletionsApi", () => {
},
}));

const response = await new USAutocompletionsApi(
const response = await new UsAutocompletionsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
).autocomplete(autocompletionInput);
expect(response.suggestions).toBeDefined();
Expand All @@ -71,7 +71,7 @@ describe("USAutocompletionsApi", () => {
},
}));

const response = await new USAutocompletionsApi(
const response = await new UsAutocompletionsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
).autocomplete(autocompletionInput);
expect(response.suggestions).toBeDefined();
Expand All @@ -87,7 +87,7 @@ describe("USAutocompletionsApi", () => {
});

try {
await new USAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
await new UsAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
autocompletionInput
);
fail("Should throw");
Expand All @@ -105,7 +105,7 @@ describe("USAutocompletionsApi", () => {
});

try {
await new USAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
await new UsAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
autocompletionInput
);
fail("Should throw");
Expand All @@ -123,7 +123,7 @@ describe("USAutocompletionsApi", () => {
});

try {
await new USAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
await new UsAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
autocompletionInput
);
fail("Should throw");
Expand All @@ -138,7 +138,7 @@ describe("USAutocompletionsApi", () => {
});

try {
await new USAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
await new UsAutocompletionsApi(CONFIG_FOR_UNIT).autocomplete(
autocompletionInput
);
fail("Should throw");
Expand Down
44 changes: 22 additions & 22 deletions __tests__/UsVerifications.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
UsVerificationDeliverabilityEnum,
IntlVerificationStatusEnum,
} from "../models";
import { USVerificationsApi } from "../api";
import { UsVerificationsApi } from "../api";

import { fail } from "./testUtilities";
import {
Expand All @@ -20,21 +20,21 @@ jest.mock("axios", () => ({
request: jest.fn(),
}));

describe("USVerificationsApi", () => {
describe("UsVerificationsApi", () => {
it("can be instantiated", () => {
const verificationApi = new USVerificationsApi(CONFIG_FOR_UNIT);
const verificationApi = new UsVerificationsApi(CONFIG_FOR_UNIT);
expect(verificationApi).toBeDefined();
expect(typeof verificationApi).toEqual("object");
expect(verificationApi).toBeInstanceOf(USVerificationsApi);
expect(verificationApi).toBeInstanceOf(UsVerificationsApi);
});

it("can be instantiated with base options", () => {
const verificationApi = new USVerificationsApi(
const verificationApi = new UsVerificationsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
);
expect(verificationApi).toBeDefined();
expect(typeof verificationApi).toEqual("object");
expect(verificationApi).toBeInstanceOf(USVerificationsApi);
expect(verificationApi).toBeInstanceOf(UsVerificationsApi);
});

describe("verifySingle", () => {
Expand All @@ -44,7 +44,7 @@ describe("USVerificationsApi", () => {
};

it("exists", () => {
const verificationApi = new USVerificationsApi(CONFIG_FOR_UNIT);
const verificationApi = new UsVerificationsApi(CONFIG_FOR_UNIT);
expect(verificationApi.verifySingle).toBeDefined();
expect(typeof verificationApi.verifySingle).toEqual("function");
});
Expand All @@ -58,7 +58,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
verification
);
} catch (err: any) {
Expand All @@ -75,7 +75,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
verification
);
fail("Should throw");
Expand All @@ -93,7 +93,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
verification
);
fail("Should throw");
Expand All @@ -108,7 +108,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifySingle(
verification
);
fail("Should throw");
Expand All @@ -122,7 +122,7 @@ describe("USVerificationsApi", () => {
data: { deliverability: UsVerificationDeliverabilityEnum.Deliverable },
}));

const response = await new USVerificationsApi(
const response = await new UsVerificationsApi(
CONFIG_FOR_UNIT
).verifySingle(verification);
expect(response).toBeDefined();
Expand All @@ -136,7 +136,7 @@ describe("USVerificationsApi", () => {
data: { deliverability: UsVerificationDeliverabilityEnum.Deliverable },
}));

const response = await new USVerificationsApi(
const response = await new UsVerificationsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
).verifySingle(verification);
expect(response).toBeDefined();
Expand All @@ -150,7 +150,7 @@ describe("USVerificationsApi", () => {
data: { deliverability: UsVerificationDeliverabilityEnum.Deliverable },
}));

const response = await new USVerificationsApi(
const response = await new UsVerificationsApi(
CONFIG_FOR_UNIT
).verifySingle(verification, "upper");
expect(response).toBeDefined();
Expand All @@ -175,7 +175,7 @@ describe("USVerificationsApi", () => {
};

it("exists", () => {
const verificationApi = new USVerificationsApi(CONFIG_FOR_UNIT);
const verificationApi = new UsVerificationsApi(CONFIG_FOR_UNIT);
expect(verificationApi.verifyBulk).toBeDefined();
expect(typeof verificationApi.verifyBulk).toEqual("function");
});
Expand All @@ -189,7 +189,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
} catch (err: any) {
expect(err.message).toEqual("error reported by API");
}
Expand All @@ -204,7 +204,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
fail("Should throw");
} catch (err: any) {
expect(err.message).toEqual("error");
Expand All @@ -220,7 +220,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
fail("Should throw");
} catch (err: any) {
expect(err.message).toEqual("error");
Expand All @@ -233,7 +233,7 @@ describe("USVerificationsApi", () => {
});

try {
await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(verification);
fail("Should throw");
} catch (err: any) {
expect(err.message).toEqual("Unknown Error");
Expand All @@ -255,7 +255,7 @@ describe("USVerificationsApi", () => {
],
},
}));
const response = await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(
const response = await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(
verification
);
expect(response).toBeDefined();
Expand All @@ -278,7 +278,7 @@ describe("USVerificationsApi", () => {
},
}));

const response = await new USVerificationsApi(
const response = await new UsVerificationsApi(
CONFIG_WITH_BASE_OPTIONS_FOR_UNIT
).verifyBulk(verification);
expect(response.addresses?.length).toEqual(2);
Expand All @@ -299,7 +299,7 @@ describe("USVerificationsApi", () => {
],
},
}));
const response = await new USVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(
const response = await new UsVerificationsApi(CONFIG_FOR_UNIT).verifyBulk(
verification,
"proper"
);
Expand Down
Loading

0 comments on commit 1f3bac9

Please sign in to comment.