@sendgrid/helpers
Advanced tools
Comparing version 7.2.4 to 7.2.6
@@ -58,7 +58,3 @@ 'use strict'; | ||
} | ||
// Wrap name in quotes to address API issue | ||
// https://github.com/sendgrid/sendgrid-csharp/issues/268#issuecomment-232177443 | ||
const isQuoted = (name[0] === '\"') && (name[name.length - 1] === '\"'); | ||
const shouldQuote = name.includes(',') && !isQuoted; | ||
this.name = shouldQuote ? `\"${name}\"` : name; | ||
this.name = name; | ||
} | ||
@@ -65,0 +61,0 @@ |
@@ -58,5 +58,5 @@ 'use strict'; | ||
it('should wrap name in quotes if a comma is present', function() { | ||
it('should not wrap name in quotes if a comma is present', function() { | ||
email.setName('Doe, John'); | ||
expect(email.name).to.equal('\"Doe, John\"'); | ||
expect(email.name).to.equal('Doe, John'); | ||
}); | ||
@@ -63,0 +63,0 @@ |
@@ -444,6 +444,6 @@ 'use strict'; | ||
} | ||
if (!attachments.every(attachment => attachment.type && typeof attachment.type === 'string')) { | ||
if (!attachments.every(attachment => !attachment.type || typeof attachment.type === 'string')) { | ||
throw new Error('Expected the attachment\'s `type` field to be a string'); | ||
} | ||
if (!attachments.every(attachment => attachment.disposition && typeof attachment.disposition === 'string')) { | ||
if (!attachments.every(attachment => !attachment.disposition || typeof attachment.disposition === 'string')) { | ||
throw new Error('Expected the attachment\'s `disposition` field to be a string'); | ||
@@ -450,0 +450,0 @@ } |
@@ -13,4 +13,3 @@ 'use strict'; | ||
describe('Mail', function() { | ||
describe('#527', function() { | ||
describe('construct', function() { | ||
it('shouldn\'t convert the headers to camel/snake case', function() { | ||
@@ -44,4 +43,2 @@ const mail = new Mail({ | ||
}); | ||
}); | ||
describe('#689', function() { | ||
@@ -68,2 +65,3 @@ it('should detect dynamic template id', function() { | ||
}); | ||
it('should detect legacy template id', function() { | ||
@@ -89,2 +87,3 @@ const mail = new Mail({ | ||
}); | ||
it('should ignore substitutions if templateId is dynamic', function() { | ||
@@ -161,2 +160,35 @@ const mail = new Mail({ | ||
describe('attachments', () => { | ||
it('handles multiple attachments', () => { | ||
const mail = new Mail({ | ||
to: 'recipient@example.org', | ||
attachments: [{ | ||
content: 'test-content', | ||
filename: 'name-that-file', | ||
type: 'file-type', | ||
}, { | ||
content: 'other-content', | ||
filename: 'name-this-file', | ||
disposition: 'inline', | ||
}], | ||
}); | ||
expect(mail.toJSON()['attachments']).to.have.a.lengthOf(2); | ||
}); | ||
it('requires content', () => { | ||
expect(() => new Mail({ | ||
attachments: [{ | ||
filename: 'missing content', | ||
}], | ||
})).to.throw('content'); | ||
}); | ||
it('requires filename', () => { | ||
expect(() => new Mail({ | ||
attachments: [{ | ||
content: 'missing filename', | ||
}], | ||
})).to.throw('filename'); | ||
}); | ||
}); | ||
}); | ||
@@ -163,0 +195,0 @@ |
{ | ||
"name": "@sendgrid/helpers", | ||
"description": "Twilio SendGrid NodeJS internal helpers", | ||
"version": "7.2.4", | ||
"version": "7.2.6", | ||
"author": "Twilio SendGrid <help@twilio.com> (sendgrid.com)", | ||
@@ -36,3 +36,3 @@ "contributors": [ | ||
}, | ||
"gitHead": "5b06b5d2e146e13a83f24945fd8650695789adc6" | ||
"gitHead": "017fe1a56391cfe5d74c3d432881dbdc44287d41" | ||
} |
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
137915
4555