Comparing version 1.6.1 to 1.6.2
@@ -82,3 +82,5 @@ /** | ||
parentObj[newKey] = parentObj[key][0][subKey]; | ||
// `compact` avoids creating an array of `[undefined]`, | ||
// from input `['']` when xml "array" element was empty. | ||
parentObj[newKey] = _.compact(parentObj[key][0][subKey]); | ||
delete parentObj[key]; | ||
@@ -85,0 +87,0 @@ |
{ | ||
"name": "ebay-api", | ||
"description": "eBay API Client", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"homepage": "https://github.com/benbuckman/nodejs-ebay-api", | ||
@@ -6,0 +6,0 @@ "author": "Ben Buckman", |
@@ -120,2 +120,43 @@ require('./helpers'); | ||
context('Empty Trading:GetOrders response', function() { | ||
var responseXml, responseJson, parsedResponse; | ||
var requestContext = { | ||
serviceName: 'Trading', | ||
opType: 'GetOrders', | ||
parseDepth: -1 | ||
}; | ||
beforeEach('load mock response', function () { | ||
responseXml = fs.readFileSync(path.resolve(__dirname, 'mocks', 'GetOrders-empty.xml'), {encoding: 'utf8'}); | ||
}); | ||
beforeEach('convert xml to json', function (done) { | ||
convertXmlToJson(responseXml, requestContext, function (error, _json) { | ||
if (error) return done(error); | ||
responseJson = _json; | ||
done(); | ||
}); | ||
}); | ||
beforeEach('parse json', function (done) { | ||
parseResponseJson(responseJson, requestContext, function (error, _data) { | ||
if (error) return done(error); | ||
parsedResponse = _data; | ||
done(); | ||
}); | ||
}); | ||
it('converted XML to JSON', function () { | ||
expect(responseJson).to.have.property('GetOrdersResponse'); | ||
}); | ||
it('converted <OrderArray> to empty `Orders` array', function() { | ||
expect(parsedResponse).to.have.property('Orders'); | ||
expect(parsedResponse).not.to.have.property('OrderArray'); | ||
expect(parsedResponse.Orders).to.have.length(0); | ||
}); | ||
}); | ||
context('Shopping:GetMultipleItems response', function () { | ||
@@ -122,0 +163,0 @@ var responseXml, responseJson, parsedResponse, requestContext; |
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
96095
31
1600