smartystreets-javascript-sdk 1.11.11 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/make -f
2
2
 
3
- VERSION := $(shell tagit -p --dry-run)
3
+ VERSION := $(shell tagit -m --dry-run)
4
4
  VERSION_FILE1 := package.json
5
5
  VERSION_FILE2 := package-lock.json
6
6
 
@@ -14,7 +14,7 @@ node_modules:
14
14
  npm install
15
15
 
16
16
  publish: clean test version upload unversion
17
- tagit -p
17
+ tagit -m
18
18
  git push origin --tags
19
19
 
20
20
  upload:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartystreets-javascript-sdk",
3
- "version": "1.11.11",
3
+ "version": "1.12.0",
4
4
  "description": "Quick and easy Smarty address validation.",
5
5
  "keywords": [
6
6
  "smarty",
@@ -15,6 +15,7 @@ class Client {
15
15
  request.parameters = {
16
16
  search: lookup.search,
17
17
  country: lookup.country,
18
+ max_results: lookup.max_results,
18
19
  include_only_administrative_area: lookup.include_only_administrative_area,
19
20
  include_only_locality: lookup.include_only_locality,
20
21
  include_only_postal_code: lookup.include_only_postal_code,
@@ -1,9 +1,10 @@
1
1
  class Lookup {
2
- constructor(search = "", country = "United States", include_only_administrative_area = "", include_only_locality = "", include_only_postal_code = "") {
2
+ constructor(search = "", country = "United States", max_results = undefined, include_only_administrative_area = "", include_only_locality = "", include_only_postal_code = "") {
3
3
  this.result = [];
4
4
 
5
5
  this.search = search;
6
6
  this.country = country;
7
+ this.max_results = max_results;
7
8
  this.include_only_administrative_area = include_only_administrative_area;
8
9
  this.include_only_locality = include_only_locality;
9
10
  this.include_only_postal_code = include_only_postal_code;
@@ -17,6 +17,7 @@ describe("An International Address Autocomplete Client", function () {
17
17
  let lookup = new Lookup(search);
18
18
  let expectedParameters = {
19
19
  search: search,
20
+ max_results: undefined,
20
21
  include_only_administrative_area: "",
21
22
  include_only_locality: "",
22
23
  include_only_postal_code: "",
@@ -36,6 +37,27 @@ describe("An International Address Autocomplete Client", function () {
36
37
  lookup.country = "Russia";
37
38
  let expectedParameters = {
38
39
  country: "Russia",
40
+ max_results: undefined,
41
+ include_only_administrative_area: "",
42
+ include_only_locality: "",
43
+ include_only_postal_code: "",
44
+ search: search,
45
+ };
46
+
47
+ client.send(lookup);
48
+ expect(mockSender.request.parameters).to.deep.equal(expectedParameters);
49
+ });
50
+
51
+ it("builds parameters with different max results", function () {
52
+ let mockSender = new MockSender();
53
+ let client = new Client(mockSender);
54
+ let search = "(";
55
+ let lookup = new Lookup(search);
56
+ lookup.search = search;
57
+ lookup.max_results = 10;
58
+ let expectedParameters = {
59
+ country: "United States",
60
+ max_results: 10,
39
61
  include_only_administrative_area: "",
40
62
  include_only_locality: "",
41
63
  include_only_postal_code: "",
@@ -24,27 +24,27 @@ describe("An International Address Autocomplete lookup", function () {
24
24
  it("Set include only administrative area param", function () {
25
25
  const administrativeArea = "administrative area";
26
26
  const expectedPrefix = "z";
27
- let lookup = new Lookup(expectedPrefix, "Utah", administrativeArea);
27
+ let lookup = new Lookup(expectedPrefix, "Utah", "test", administrativeArea);
28
28
  expect(lookup.include_only_administrative_area).to.equal(administrativeArea);
29
29
  });
30
30
 
31
31
  it("Set include only locality param", function () {
32
32
  const locality = "locality";
33
33
  const expectedPrefix = "z";
34
- let lookup = new Lookup(expectedPrefix, "Utah", "test", locality);
34
+ let lookup = new Lookup(expectedPrefix, "Utah", "test", "test", locality);
35
35
  expect(lookup.include_only_locality).to.equal(locality);
36
36
  });
37
37
 
38
38
  it("Set include only postal code param", function () {
39
39
  const postalCode = "locality";
40
40
  const expectedPrefix = "z";
41
- let lookup = new Lookup(expectedPrefix, "Utah", "test", "test", postalCode);
41
+ let lookup = new Lookup(expectedPrefix, "Utah", "test", "test", "test", postalCode);
42
42
  expect(lookup.include_only_postal_code).to.equal(postalCode);
43
43
  });
44
44
 
45
45
  it("Checking defaults of params on instantiation ", function () {
46
- const defaultLookup = new Lookup("", "United States", "", "", "");
46
+ const defaultLookup = new Lookup("", "United States", undefined, "", "", "");
47
47
  let lookup = new Lookup();
48
- expect(lookup).to.eql(defaultLookup);
48
+ expect(lookup).to.deep.equal(defaultLookup);
49
49
  });
50
50
  });