New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cdrator

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdrator - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

test/unit/soaper/subscribeProductOptions.spec.js

4

lib/cdrator.js

@@ -46,2 +46,6 @@ var invoker = require('./invoker');

CDRator.prototype.subscribeProductOptions = function () {
return this.send('SOAP_SUBSCRIBE_PRODUCT_OPTIONS', Array.prototype.slice.call(arguments));
};
CDRator.prototype.validatePersonalIdForSignup = function (personalId) {

@@ -48,0 +52,0 @@ return this.send('SOAP_VALIDATE_PERSONAL_ID_FOR_SIGNUP', {

48

lib/soaper.js

@@ -14,2 +14,6 @@ var xmlBuilder = require('xmlbuilder'),

function depluralize(name) {
return name.substring(0, name.length -1);
}
function getXsi(value, index, type) {

@@ -27,3 +31,4 @@ return {

function buildValue(key, value, index) {
function buildValue(key, value, index, single) {
/*jshint maxcomplexity:false */
var type;

@@ -38,3 +43,3 @@ if(value.type) {

var xsi = getXsi(value, index + 1, type);
var xmlns = getXmlNs(index + 1);
var xmlns = (single) ? null : getXmlNs(index + 1);

@@ -59,18 +64,29 @@ var values;

default:
values = [xsi, xmlns, {key: changeCase.constantCase(key)}]
.concat(Object.keys(value).map(function (key) {
return {
'value': {
'@xsi:type': 'q' + (index+1) + ':stringValueDTO',
'key': changeCase.constantCase(key),
'value': secure(value[key])
}
};
}));
if(value instanceof Array) {
values = [xsi, xmlns, {key: changeCase.constantCase(key)}]
.concat(value.map(function (item) {
return buildValue(depluralize(key), item, index, true);
}));
} else {
values = [xsi, xmlns, {key: changeCase.constantCase(key)}]
.concat(Object.keys(value).map(function (key) {
var val = value[key];
return {
'value': {
'@xsi:type': 'q' + (index+1) + ':stringValueDTO',
'key': changeCase.constantCase(key),
'value': secure(val)
}
};
}));
}
values = values.filter(function (item) { return item; });
break;
}
return {
'values': values
};
var result = {};
var resultKey = (single) ? 'value' : 'values';
result[resultKey] = values;
return result;
}

@@ -85,3 +101,3 @@

Object.keys(args).map(function (key, ix) {
return buildValue(key, args[key], ix, true);
return buildValue(key, args[key], ix);
})

@@ -88,0 +104,0 @@ );

{
"name": "cdrator",
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"main": "lib/cdrator",
"scripts": {
"test": "npm test"
"test": "gulp lint test",
"patch-release": "npm version patch && npm publish && git push origin master --follow-tags",
"minor-release": "npm version minor && npm publish && git push origin master --follow-tags",
"major-release": "npm version major && npm publish && git push origin master --follow-tags"
},

@@ -9,0 +12,0 @@ "author": "Johan Öbrink <johan.obrink@gmail.com>",

@@ -36,6 +36,6 @@ var chai = require('chai'),

});
describe('doAddressCheck', function () {
describe('doCreditCheck', function () {
it('calls send with the correct parameters', function () {
var hookpoint = 'SOAP_DO_ADDRESS_CHECK';
cdrator.doAddressCheck('197001010101');
var hookpoint = 'SOAP_DO_CREDIT_CHECK';
cdrator.doCreditCheck('197001010101');

@@ -45,6 +45,6 @@ expect(invoker.send).calledOnce.calledWith(config, context, hookpoint, {personalId: '197001010101'});

});
describe('doCreditCheck', function () {
describe('doAddressCheck', function () {
it('calls send with the correct parameters', function () {
var hookpoint = 'SOAP_DO_CREDIT_CHECK';
cdrator.doCreditCheck('197001010101');
var hookpoint = 'SOAP_DO_ADDRESS_CHECK';
cdrator.doAddressCheck('197001010101');

@@ -85,2 +85,13 @@ expect(invoker.send).calledOnce.calledWith(config, context, hookpoint, {personalId: '197001010101'});

});
describe('subscribeProductOptions', function () {
it('calls send with the correct parameters', function () {
var hookpoint = 'SOAP_SUBSCRIBE_PRODUCT_OPTIONS';
cdrator.subscribeProductOptions({id: '201305302066666666'}, {id: '201305302066666667'});
expect(invoker.send).calledOnce.calledWith(config, context, hookpoint, [
{id: '201305302066666666'},
{id: '201305302066666667'}
]);
});
});
describe('validatePersonalIdForSignup', function () {

@@ -87,0 +98,0 @@ it('calls send with the correct parameters', function () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc