smartystreets-javascript-sdk
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "smartystreets-javascript-sdk", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Quick and easy SmartyStreets address validation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ class Request { | ||
this.headers = { | ||
"Content-Type": "application/json", | ||
"Content-Type": "application/json; charset=utf-8", | ||
}; | ||
@@ -9,0 +9,0 @@ |
@@ -18,3 +18,4 @@ const Errors = require("../Errors"); | ||
let request = new Request(buildRequestPayload(lookup)); | ||
let request = new Request(lookup.text); | ||
request.parameters = buildRequestParams(lookup); | ||
@@ -32,5 +33,4 @@ return new Promise((resolve, reject) => { | ||
function buildRequestPayload(lookup) { | ||
function buildRequestParams(lookup) { | ||
return { | ||
text: lookup.text, | ||
html: lookup.html, | ||
@@ -37,0 +37,0 @@ aggressive: lookup.aggressive, |
@@ -66,3 +66,3 @@ const chai = require("chai"); | ||
expect(requestConfig.hasOwnProperty("headers")).to.equal(true); | ||
expect(requestConfig.headers["Content-Type"]).to.equal("application/json"); | ||
expect(requestConfig.headers["Content-Type"]).to.equal("application/json; charset=utf-8"); | ||
}); | ||
@@ -69,0 +69,0 @@ |
@@ -25,9 +25,3 @@ const chai = require("chai"); | ||
let lookup = new Lookup(mockText); | ||
let expectedPayload = { | ||
text: mockText, | ||
html: undefined, | ||
aggressive: undefined, | ||
addr_line_breaks: undefined, | ||
addr_per_line: undefined, | ||
}; | ||
let expectedPayload = mockText; | ||
@@ -39,3 +33,3 @@ client.send(lookup); | ||
it("correctly builds parameters for a fully-populated lookup.", function () { | ||
it("correctly builds a payload for a fully-populated lookup.", function () { | ||
let mockSender = new MockSender(); | ||
@@ -45,2 +39,14 @@ let client = new Client(mockSender); | ||
let lookup = new Lookup(mockText); | ||
let expectedPayload = mockText; | ||
client.send(lookup); | ||
expect(mockSender.request.payload).to.deep.equal(expectedPayload); | ||
}); | ||
it("correctly builds parameters for a lookup.", () => { | ||
let mockSender = new MockSender(); | ||
let client = new Client(mockSender); | ||
const mockText = "Picard is coming back. All power to the engines."; | ||
let lookup = new Lookup(mockText); | ||
lookup.html = 1; | ||
@@ -51,4 +57,3 @@ lookup.aggressive = 2; | ||
let expectedPayload = { | ||
text: mockText, | ||
let expectedParams = { | ||
html: 1, | ||
@@ -62,3 +67,3 @@ aggressive: 2, | ||
expect(mockSender.request.payload).to.deep.equal(expectedPayload); | ||
expect(mockSender.request.parameters).to.deep.equal(expectedParams); | ||
}); | ||
@@ -65,0 +70,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119990
71
2740