Comparing version 0.9.0 to 1.0.0
@@ -17,3 +17,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -20,0 +20,0 @@ console.log(err); |
@@ -14,3 +14,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -17,0 +17,0 @@ console.log(err); |
@@ -38,3 +38,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -41,0 +41,0 @@ console.log(err); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -18,0 +18,0 @@ console.log(err); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -18,0 +18,0 @@ console.log(err); |
@@ -14,3 +14,3 @@ 'use strict'; | ||
client.transmissions.send(trans, function(err, res) { | ||
client.transmissions.send({transmissionBody: trans}, function(err, res) { | ||
if (err) { | ||
@@ -17,0 +17,0 @@ console.log(err); |
@@ -38,3 +38,3 @@ var matchdep = require('matchdep') | ||
, commitMessage: 'Release %VERSION%' | ||
, commitFiles: [ 'package.json', 'README.md' ] | ||
, commitFiles: [ 'package.json', 'CHANGELOG.md' ] | ||
, createTag: true | ||
@@ -41,0 +41,0 @@ , tagName: '%VERSION%' |
'use strict'; | ||
var api = 'recipient-lists'; | ||
var api = 'recipient-lists' | ||
, toApiFormat = require('./toApiFormat'); | ||
var toApiFormat = function(input) { | ||
var model = input; | ||
return model; | ||
}; | ||
module.exports = function(client) { | ||
@@ -12,0 +7,0 @@ var recipientLists = { |
@@ -122,3 +122,3 @@ 'use strict'; | ||
var translated = translatePayload(payload); | ||
this.client.transmissions.send(translated, callback); | ||
this.client.transmissions.send({transmissionBody: translated }, callback); | ||
}; | ||
@@ -125,0 +125,0 @@ |
'use strict'; | ||
var api = 'sending-domains'; | ||
var api = 'sending-domains' | ||
, toApiFormat = require('./toApiFormat'); | ||
/** | ||
* Private Method for migrating the flat user input into | ||
* a format that the Sending Domains REST API expects | ||
* | ||
* This method does not perform any validation of the user's input, we | ||
* rely on the API to return appropriate errors for all the weird combinations | ||
* of things, like you can't specify rfc822 content and then specify html/plaintext | ||
* | ||
* @param input object Flat object of configuration for the sending domain to be sent | ||
* @returns object | ||
*/ | ||
var toApiFormat = function(input) { | ||
var model = { | ||
dkim: {} | ||
}; | ||
model.domain = input.domainName; | ||
model.dkim['private'] = input.privateKey; | ||
model.dkim['public'] = input.publicKey; | ||
model.dkim.selector = input.selector; | ||
model.dkim.headers = input.headers; | ||
return model; | ||
}; | ||
/* | ||
@@ -47,10 +23,10 @@ * "Class" declaration, Sending Domains API exposes five functions: | ||
}, | ||
find: function (domainName, callback) { //retrieve | ||
if(typeof domainName === 'function') { | ||
callback = domainName; | ||
domainName = null; | ||
find: function (domain, callback) { //retrieve | ||
if(typeof domain === 'function') { | ||
callback = domain; | ||
domain = null; | ||
} | ||
if(!domainName) { | ||
callback(new Error('domainName is required')); | ||
if(!domain) { | ||
callback(new Error('domain is required')); | ||
return; | ||
@@ -60,3 +36,3 @@ } | ||
var options = { | ||
uri: api + '/' + domainName | ||
uri: api + '/' + domain | ||
}; | ||
@@ -76,4 +52,4 @@ client.get(options, callback); | ||
if(!domainBody.domainName) { | ||
callback(new Error('domainName is required in the domainBody')); | ||
if(!domainBody.domain) { | ||
callback(new Error('domain is required in the domainBody')); | ||
return; | ||
@@ -99,4 +75,4 @@ } | ||
if(!domainBody.domainName) { | ||
callback(new Error('domainName is required in the domainBody')); | ||
if(!domainBody.domain) { | ||
callback(new Error('domain is required in the domainBody')); | ||
return; | ||
@@ -106,2 +82,3 @@ } | ||
var obj = toApiFormat(domainBody); | ||
console.log( obj ); | ||
var options = { | ||
@@ -116,4 +93,4 @@ uri: api + '/' + obj.domain | ||
if(!options.domainName) { | ||
callback(new Error('domainName is required')); | ||
if(!options.domain) { | ||
callback(new Error('domain is required')); | ||
return; | ||
@@ -123,3 +100,3 @@ } | ||
var reqOpts = { | ||
uri: api + '/' + options.domainName + '/verify', | ||
uri: api + '/' + options.domain + '/verify', | ||
json: { | ||
@@ -126,0 +103,0 @@ dkim_verify: options.verifyDKIM !== false, |
@@ -88,18 +88,14 @@ 'use strict'; | ||
request(options, function(err, res, body) { | ||
var parsedBody; | ||
var invalidCodeRegex = /(5|4)[0-9]{2}/; | ||
if(err) { | ||
callback(err, null); | ||
return; | ||
return callback(err, res); | ||
} else if(invalidCodeRegex.test(res.statusCode)) { | ||
err = new Error(res.statusMessage); | ||
err.name = 'SparkPostError'; | ||
err.errors = body.errors; | ||
err.statusCode = res.statusCode; | ||
return callback(err, res); | ||
} else { | ||
return callback(null, res); | ||
} | ||
// trying to parse body | ||
try { | ||
parsedBody = JSON.parse(body); | ||
} catch(err) { | ||
parsedBody = body; | ||
} | ||
callback(null, {res: res, body: parsedBody}); | ||
}); | ||
@@ -106,0 +102,0 @@ }; |
'use strict'; | ||
var api = 'suppression-list'; | ||
var api = 'suppression-list' | ||
, toApiFormat = require('./toApiFormat'); | ||
var toApiFormat = function(input) { | ||
var model = { | ||
recipients: input | ||
}; | ||
return model; | ||
}; | ||
module.exports = function(client) { | ||
@@ -14,0 +7,0 @@ |
'use strict'; | ||
var api = 'templates'; | ||
var api = 'templates' | ||
, toApiFormat = require('./toApiFormat'); | ||
var toApiFormat = function(input) { | ||
var model = input; | ||
return model; | ||
}; | ||
module.exports = function(client) { | ||
@@ -12,0 +7,0 @@ var templates = { |
'use strict'; | ||
var api = 'transmissions'; | ||
var api = 'transmissions' | ||
, toApiFormat = require('./toApiFormat'); | ||
/** | ||
* Private Method for migrating the flat user input into | ||
* a format that the Transmissions REST API expects | ||
* | ||
* This method does not perform any validation of the user's input, we | ||
* rely on the API to return appropriate errors for all the weird combinations | ||
* of things, like you can't specify rfc822 content and then specify html/plaintext | ||
* | ||
* @param input object Flat object of configuration for the transmission to be sent | ||
* @returns object | ||
*/ | ||
var toApiFormat = function(input) { | ||
var model = { | ||
content: {}, | ||
options: {}, | ||
recipients: {} | ||
}; | ||
model.description = input.description; | ||
model.return_path = input.returnPath || 'default@sparkpostmail.com'; | ||
model.campaign_id = input.campaign; | ||
model.metadata = input.metadata; | ||
model.substitution_data = input.substitutionData; | ||
model.options.open_tracking = input.trackOpens; | ||
model.options.click_tracking = input.trackClicks; | ||
model.options.sandbox = input.useSandbox; | ||
model.content.use_draft_template = input.useDraftTemplate || false; | ||
model.content.reply_to = input.replyTo; | ||
model.content.subject = input.subject; | ||
model.content.from = input.from; | ||
model.content.html = input.html; | ||
model.content.text = input.text; | ||
model.content.email_rfc822 = input.rfc822; | ||
model.content.template_id = input.template; | ||
model.content.headers = input.customHeaders; | ||
model.recipients.list_id = input.recipientList; | ||
model.recipients = input.recipients; | ||
return model; | ||
}; | ||
/* | ||
@@ -57,10 +14,6 @@ * "Class" declaration, Transmissions exposes three functions, one for sending a transmission, | ||
return { | ||
send: function (transmissionBody, callback) { | ||
send: function (options, callback) { | ||
options = options || {}; | ||
if(typeof transmissionBody === 'function') { | ||
callback = transmissionBody; | ||
transmissionBody = null; | ||
} | ||
if(!transmissionBody) { | ||
if(!options.transmissionBody) { | ||
callback(new Error('transmissionBody is required')); | ||
@@ -70,5 +23,5 @@ return; | ||
var mappedInput = toApiFormat(transmissionBody); | ||
var mappedInput = toApiFormat(options.transmissionBody); | ||
var options = { | ||
var reqOpts = { | ||
uri: api, | ||
@@ -78,10 +31,30 @@ json: mappedInput | ||
client.post(options, callback); | ||
if (options.num_rcpt_errors) { | ||
reqOpts.qs = reqOpts.qs || {}; | ||
reqOpts.qs.num_rcpt_errors = options.num_rcpt_errors; | ||
delete options.num_rcpt_errors; | ||
} | ||
client.post(reqOpts, callback); | ||
}, | ||
all: function (callback) { | ||
var options = { | ||
uri: api | ||
all: function (options, callback) { | ||
if(typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
var reqOpts = { | ||
uri: api, | ||
qs: {} | ||
}; | ||
client.get(options, callback); | ||
if (options.campaign_id) { | ||
reqOpts.qs.campaign_id = options.campaign_id; | ||
} | ||
if (options.template_id) { | ||
reqOpts.qs.template_id = options.template_id; | ||
} | ||
client.get(reqOpts, callback); | ||
}, | ||
@@ -88,0 +61,0 @@ find: function (transmissionID, callback) { |
'use strict'; | ||
var _ = require('lodash') | ||
, api = 'webhooks'; | ||
var api = 'webhooks' | ||
, toApiFormat = require('./toApiFormat'); | ||
var toApiFormat = function(input) { | ||
var model = _.clone(input); | ||
delete model.id; | ||
return model; | ||
}; | ||
module.exports = function(client) { | ||
@@ -15,0 +7,0 @@ var webhooks = { |
{ | ||
"name": "sparkpost", | ||
"version": "0.9.0", | ||
"version": "1.0.0", | ||
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs", | ||
@@ -9,2 +9,6 @@ "main": "./lib/sparkpost.js", | ||
}, | ||
"keywords": [ | ||
"email", | ||
"messaging" | ||
], | ||
"repository": { | ||
@@ -38,5 +42,6 @@ "type": "git", | ||
"dependencies": { | ||
"lodash": "3.9.3", | ||
"request": "2.42.0", | ||
"lodash": "2.4.1" | ||
"snake-case": "^1.1.1" | ||
} | ||
} |
@@ -65,3 +65,3 @@ [![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) | ||
```js | ||
process.env.SPARKPOST_API_KEY = 'YOUR_API_KEY'; | ||
//Create an env var as SPARKPOST_API_KEY | ||
var SparkPost = require('sparkpost'); | ||
@@ -109,3 +109,3 @@ var client = new SparkPost(); | ||
* [Templates](/docs/resources/templates.md) - `client.templates` ([examples](/examples/templates)) | ||
* [Transmissions](/docs/apis/transmissions.md) - `client.transmission` ([examples](/examples/transmissions)) | ||
* [Transmissions](/docs/resources/transmissions.md) - `client.transmissions` ([examples](/examples/transmissions)) | ||
* [Webhooks](/docs/resources/webhooks.md) - `client.webhooks` ([examples](/examples/webhooks)) | ||
@@ -130,1 +130,5 @@ | ||
[Submitting pull requests](CONTRIBUTING.md) | ||
### ChangeLog | ||
[See ChangeLog here](CHANGELOG.md) |
@@ -91,5 +91,5 @@ var chai = require('chai') | ||
it('should handle an absence of toname', function(done) { | ||
var toPayload = { to: 'asdf@qwerty.lg.jp'}; | ||
var toPayload = {to: 'asdf@qwerty.lg.jp'}; | ||
sendgrid.send(toPayload, function() { | ||
expect(sendSpy.args[0][0].recipients).to.deep.equal([{ address: { email: 'asdf@qwerty.lg.jp' }}]); | ||
expect(sendSpy.args[0][0].transmissionBody.recipients).to.deep.equal([{ address: { email: 'asdf@qwerty.lg.jp' }}]); | ||
done(); | ||
@@ -102,3 +102,3 @@ }); | ||
sendgrid.send(subPayload, function() { | ||
expect(sendSpy.args[0][0].substitutionData).to.deep.equal({ password: [ '******' ], num: [ 'one', 'two' ]}); | ||
expect(sendSpy.args[0][0].transmissionBody.substitutionData).to.deep.equal({ password: [ '******' ], num: [ 'one', 'two' ]}); | ||
done(); | ||
@@ -111,3 +111,3 @@ }); | ||
sendgrid.send(sectionPayload, function() { | ||
expect(sendSpy.args[0][0].substitutionData).to.deep.equal({ something: 'something else'}); | ||
expect(sendSpy.args[0][0].transmissionBody.substitutionData).to.deep.equal({ something: 'something else'}); | ||
done(); | ||
@@ -120,3 +120,3 @@ }); | ||
sendgrid.send(barePayload, function() { | ||
expect(sendSpy.args[0][0].substitutionData).to.equal(undefined); | ||
expect(sendSpy.args[0][0].transmissionBody.substitutionData).to.equal(undefined); | ||
done(); | ||
@@ -128,3 +128,3 @@ }); | ||
sendgrid.send(payload, function() { | ||
expect(sendSpy.args[0][0]).to.deep.equal(translatedPayload); | ||
expect(sendSpy.args[0][0].transmissionBody).to.deep.equal(translatedPayload); | ||
done(); | ||
@@ -131,0 +131,0 @@ }); |
@@ -38,5 +38,5 @@ var chai = require('chai') | ||
it('should throw an error if domainName is null', function(done) { | ||
it('should throw an error if domain is null', function(done) { | ||
sendingDomains.find(null, function(err) { | ||
expect(err.message).to.equal('domainName is required'); | ||
expect(err.message).to.equal('domain is required'); | ||
expect(client.get).not.to.have.been.called; | ||
@@ -47,5 +47,5 @@ done(); | ||
it('should throw an error if domainName is missing', function(done) { | ||
it('should throw an error if domain is missing', function(done) { | ||
sendingDomains.find(function(err) { | ||
expect(err.message).to.equal('domainName is required'); | ||
expect(err.message).to.equal('domain is required'); | ||
expect(client.get).not.to.have.been.called; | ||
@@ -60,3 +60,3 @@ done(); | ||
var domainBody = { | ||
domainName: "test" | ||
domain: "test" | ||
}; | ||
@@ -86,5 +86,5 @@ | ||
it('should throw an error if domainName is missing from domainBody', function(done) { | ||
it('should throw an error if domain is missing from domainBody', function(done) { | ||
sendingDomains.create({}, function(err){ | ||
expect(err.message).to.equal('domainName is required in the domainBody'); | ||
expect(err.message).to.equal('domain is required in the domainBody'); | ||
expect(client.post).not.to.have.been.called; | ||
@@ -99,3 +99,3 @@ done(); | ||
var domainBody = { | ||
domainName: "test" | ||
domain: "test" | ||
}; | ||
@@ -125,5 +125,5 @@ | ||
it('should throw an error if domainName is missing from domainBody', function(done) { | ||
it('should throw an error if domain is missing from domainBody', function(done) { | ||
sendingDomains.update({}, function(err){ | ||
expect(err.message).to.equal('domainName is required in the domainBody'); | ||
expect(err.message).to.equal('domain is required in the domainBody'); | ||
expect(client.put).not.to.have.been.called; | ||
@@ -138,3 +138,3 @@ done(); | ||
var options = { | ||
domainName: 'test' | ||
domain: 'test' | ||
}; | ||
@@ -148,5 +148,5 @@ | ||
it('should throw an error if domainName is missing', function(done) { | ||
it('should throw an error if domain is missing', function(done) { | ||
sendingDomains.verify(null, function(err) { | ||
expect(err.message).to.equal('domainName is required'); | ||
expect(err.message).to.equal('domain is required'); | ||
expect(client.post).not.to.have.been.called; | ||
@@ -159,3 +159,3 @@ done(); | ||
var options = { | ||
domainName: 'test' | ||
domain: 'test' | ||
}; | ||
@@ -172,3 +172,3 @@ | ||
var options = { | ||
domainName: 'test', | ||
domain: 'test', | ||
verifyDKIM: false, | ||
@@ -185,34 +185,2 @@ verifySPF: false | ||
}); | ||
describe('toApiFormat Helper Method', function() { | ||
it('should format domainName as domain', function(done) { | ||
var domainBody = { | ||
domainName: 'test' | ||
}; | ||
sendingDomains.create(domainBody, function() { | ||
expect(client.post.firstCall.args[0].json.domain).to.equal(domainBody.domainName); | ||
done(); | ||
}); | ||
}); | ||
it('should group DKIM fields in an object', function(done) { | ||
var domainBody = { | ||
domainName: 'test' | ||
, privateKey: 'TEST_PRIVATE_KEY' | ||
, publicKey: 'TEST_PUBLIC_KEY' | ||
, selector: 'TEST_SELECTOR' | ||
}; | ||
sendingDomains.create(domainBody, function() { | ||
expect(client.post.firstCall.args[0].json.dkim).to.deep.equal({ | ||
'private': domainBody.privateKey | ||
, 'public': domainBody.publicKey | ||
, selector: domainBody.selector | ||
, headers: domainBody.headers | ||
}); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -100,3 +100,3 @@ var chai = require('chai') | ||
// making sure original request was GET | ||
expect(data.res.request.method).to.equal('GET'); | ||
expect(data.request.method).to.equal('GET'); | ||
@@ -122,3 +122,3 @@ // finish async test | ||
client.request(options, function(err, data) { | ||
expect(data).to.be.null; | ||
expect(data).to.be.undefined; | ||
expect(err).to.be.defined; | ||
@@ -131,2 +131,24 @@ | ||
it('should return an error if statusCode not 2XX', function(done) { | ||
// simulate a timeout | ||
nock('https://api.sparkpost.com') | ||
.post('/api/v1/post/test/fail') | ||
.reply(422, { errors: [] }); | ||
var options = { | ||
method: 'POST' | ||
, uri: 'post/test/fail' | ||
}; | ||
client.request(options, function(err, data) { | ||
expect(data).to.be.defined; | ||
expect(err).to.be.defined; | ||
expect(err.errors).to.deep.equal(data.body.errors); | ||
// finish async test | ||
done(); | ||
}); | ||
}); | ||
it('should use a full URI if provided', function(done) { | ||
@@ -143,3 +165,3 @@ nock('https://test.sparkpost.com') | ||
client.request(options, function(err, data) { | ||
expect(data.res.request.uri.href).to.equal('https://test.sparkpost.com/test'); | ||
expect(data.request.uri.href).to.equal('https://test.sparkpost.com/test'); | ||
@@ -168,3 +190,3 @@ // finish async test | ||
// making sure original request was GET | ||
expect(data.res.request.method).to.equal('GET'); | ||
expect(data.request.method).to.equal('GET'); | ||
@@ -200,3 +222,3 @@ SparkPost.prototype.request.restore(); // restoring function | ||
// making sure original request was POST | ||
expect(data.res.request.method).to.equal('POST'); | ||
expect(data.request.method).to.equal('POST'); | ||
@@ -232,3 +254,3 @@ SparkPost.prototype.request.restore(); // restoring function | ||
// making sure original request was PUT | ||
expect(data.res.request.method).to.equal('PUT'); | ||
expect(data.request.method).to.equal('PUT'); | ||
@@ -264,3 +286,3 @@ SparkPost.prototype.request.restore(); // restoring function | ||
// making sure original request was DELETE | ||
expect(data.res.request.method).to.equal('DELETE'); | ||
expect(data.request.method).to.equal('DELETE'); | ||
@@ -267,0 +289,0 @@ SparkPost.prototype.request.restore(); // restoring function |
@@ -23,6 +23,28 @@ var chai = require('chai') | ||
transmission.all(function() { | ||
expect(client.get.firstCall.args[0]).to.deep.equal({uri:'transmissions'}); | ||
expect(client.get.firstCall.args[0].uri).to.equal('transmissions'); | ||
done(); | ||
}); | ||
}); | ||
it('should allow campaign_id to be set in options', function(done) { | ||
var options = { | ||
campaign_id: 'test-campaign' | ||
}; | ||
transmission.all(options, function(err, data) { | ||
expect(client.get.firstCall.args[0].qs).to.deep.equal({campaign_id: 'test-campaign'}); | ||
done(); | ||
}); | ||
}); | ||
it('should allow template_id to be set in options', function(done) { | ||
var options = { | ||
template_id: 'test-template' | ||
}; | ||
transmission.all(options, function(err, data) { | ||
expect(client.get.firstCall.args[0].qs).to.deep.equal({template_id: 'test-template'}); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -57,5 +79,9 @@ | ||
it('should call client post method with the appropriate uri', function(done) { | ||
var transmissionBody = {}; | ||
var options = { | ||
transmissionBody: { | ||
campaign: 'test-campaign' | ||
} | ||
}; | ||
transmission.send(transmissionBody, function() { | ||
transmission.send(options, function() { | ||
expect(client.post.firstCall.args[0].uri).to.equal('transmissions'); | ||
@@ -66,3 +92,3 @@ done(); | ||
it('should throw an error if transmissionBody is null', function(done) { | ||
it('should throw an error if transmissionBody is missing', function(done) { | ||
transmission.send(null, function(err) { | ||
@@ -75,63 +101,16 @@ expect(err.message).to.equal('transmissionBody is required'); | ||
it('should throw an error if transmissionBody is missing', function(done) { | ||
transmission.send(function(err) { | ||
expect(err.message).to.equal('transmissionBody is required'); | ||
expect(client.post).not.to.have.been.called; | ||
it('should allow num_rcpt_errors to be set in options', function(done) { | ||
var options = { | ||
transmissionBody: { | ||
campaign: 'test-campaign' | ||
}, | ||
num_rcpt_errors: 3 | ||
}; | ||
transmission.send(options, function(err, data) { | ||
expect(client.post.firstCall.args[0].qs).to.deep.equal({num_rcpt_errors: 3}); | ||
done(); | ||
}); | ||
}); | ||
describe('toApiFormat Helper Method', function() { | ||
it('should default the return path for sparkpost users', function(done) { | ||
transmission.send({}, function(err, res) { | ||
expect(client.post.firstCall.args[0].json.return_path).to.equal('default@sparkpostmail.com'); | ||
done(); | ||
}); | ||
}); | ||
it('should allow on prem users to override the return path', function(done) { | ||
transmission.send({returnPath: 'sketchy@weird-domain.com'}, function() { | ||
expect(client.post.firstCall.args[0].json.return_path).to.equal('sketchy@weird-domain.com'); | ||
done(); | ||
}); | ||
}); | ||
it('should default open and click tracking to be undefined', function(done) { | ||
transmission.send({}, function() { | ||
expect(client.post.firstCall.args[0].json.options.open_tracking).to.be.undefined; | ||
expect(client.post.firstCall.args[0].json.options.click_tracking).to.be.undefined; | ||
done(); | ||
}); | ||
}); | ||
it('should allow a user to set open/click tracking', function(done) { | ||
transmission.send({trackOpens: false, trackClicks: false}, function() { | ||
expect(client.post.firstCall.args[0].json.options.open_tracking).to.be.false; | ||
expect(client.post.firstCall.args[0].json.options.click_tracking).to.be.false; | ||
done(); | ||
}); | ||
}); | ||
it('should allow a user to override useSandbox ', function(done) { | ||
transmission.send({useSandbox: true}, function() { | ||
expect(client.post.firstCall.args[0].json.options.sandbox).to.be.true; | ||
done(); | ||
}); | ||
}); | ||
it('should default using a published stored template', function(done) { | ||
transmission.send({}, function() { | ||
expect(client.post.firstCall.args[0].json.content.use_draft_template).to.be.false; | ||
done(); | ||
}); | ||
}); | ||
it('should allow a user to override and use a draft stored template', function(done) { | ||
transmission.send({useDraftTemplate: true}, function() { | ||
expect(client.post.firstCall.args[0].json.content.use_draft_template).to.be.true; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
212222
93
3072
0
132
0
3
+ Addedsnake-case@^1.1.1
+ Addedlodash@3.9.3(transitive)
+ Addedlower-case@1.1.4(transitive)
+ Addedsentence-case@1.1.3(transitive)
+ Addedsnake-case@1.1.2(transitive)
+ Addedtldts@6.1.48(transitive)
+ Addedtldts-core@6.1.48(transitive)
- Removedlodash@2.4.1(transitive)
- Removedtldts@6.1.47(transitive)
- Removedtldts-core@6.1.47(transitive)
Updatedlodash@3.9.3