smartystreets-javascript-sdk 1.11.7 → 1.11.8

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
@@ -18,7 +18,10 @@ publish: clean test version upload unversion
18
18
  git push origin --tags
19
19
 
20
20
  upload:
21
- npm publish && node browserify.js && node s3.js
21
+ npm publish
22
+
23
+ upload_s3:
24
+ node browserify.js && node s3.js
22
25
 
23
26
  version:
24
27
  sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE1)" && rm -f "$(VERSION_FILE1).bak"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartystreets-javascript-sdk",
3
- "version": "1.11.7",
3
+ "version": "1.11.8",
4
4
  "description": "Quick and easy SmartyStreets address validation.",
5
5
  "keywords": [
6
6
  "smartystreets",
@@ -28,6 +28,8 @@ class Client {
28
28
  let batch;
29
29
 
30
30
  if (dataIsLookup) {
31
+ if (data.maxCandidates == null && data.match == "enhanced")
32
+ data.maxCandidates = 5;
31
33
  batch = new Batch();
32
34
  batch.add(data);
33
35
  } else {
@@ -52,6 +52,21 @@ describe("A US Street client", function () {
52
52
  expect(mockSender.request.parameters).to.deep.equal(expectedParameters);
53
53
  });
54
54
 
55
+ it("defaults maxCandidates to 5 when match type is enhanced.", function () {
56
+ let mockSender = new MockSender();
57
+ const client = new Client(mockSender);
58
+ let lookup = new Lookup();
59
+ lookup.match = "enhanced";
60
+ let expectedParameters = {
61
+ match: "enhanced",
62
+ candidates: 5,
63
+ };
64
+
65
+ client.send(lookup);
66
+
67
+ expect(mockSender.request.parameters).to.deep.equal(expectedParameters);
68
+ });
69
+
55
70
  it("doesn't send an empty batch.", function () {
56
71
  let mockSender = new MockSender();
57
72
  const client = new Client(mockSender);