-
-
Save tg44/897b69e8539183b20d2ec6b316fcd25b to your computer and use it in GitHub Desktop.
smime signer code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should create a new root MIME node with children2', (done) => { | |
const message = new MimeNode('multipart/mixed'); | |
message.setHeader({ | |
from: 'Example user <user@example.com>', | |
to: 'Example recipient <recipient@example.com>', | |
subject: 'Example message', | |
}); | |
const textNode = message.createChild('text/plain'); | |
textNode.setContent('Example\nmessage'); | |
mail = { message }; | |
plugin(mail, (err) => { | |
if (err) { | |
return done(err); | |
} | |
expect(mail.message.getHeader('Content-Type')).to.match(/multipart\/signed/); | |
expect(mail.message.childNodes).to.be.an('array'); | |
mail.message.build(function(err, message){ | |
fs.writeFileSync(path.join(__dirname, 'out.email'), message, 'binary') | |
}); | |
done(); | |
}); | |
}); | |
it('should create a new root MIME node with children3', (done) => { | |
var mailOptions = { | |
from: 'Example user <user@example.com>', | |
to: 'Example recipient <recipient@example.com>', | |
subject: 'Example message', | |
text: 'Example\nmessage', | |
}; | |
const MailComposer = require("nodemailer/lib/mail-composer"); | |
mail = new MailComposer(mailOptions); | |
mail.compile() | |
plugin(mail, (err) => { | |
if (err) { | |
return done(err); | |
} | |
expect(mail.message.getHeader('Content-Type')).to.match(/multipart\/signed/); | |
expect(mail.message.childNodes).to.be.an('array'); | |
mail.message.build(function(err, message){ | |
fs.writeFileSync(path.join(__dirname, 'out2.email'), message, 'binary') | |
}); | |
done(); | |
}); | |
}); | |
it('should create a new root MIME node with children4', (done) => { | |
var mailOptions = { | |
from: 'Example user <user@example.com>', | |
to: 'Example recipient <recipient@example.com>', | |
subject: 'Example message', | |
text: 'Example\nmessage', | |
html: 'asd' | |
}; | |
const MailComposer = require("nodemailer/lib/mail-composer"); | |
mail = new MailComposer(mailOptions); | |
mail.compile() | |
plugin(mail, (err) => { | |
if (err) { | |
return done(err); | |
} | |
expect(mail.message.getHeader('Content-Type')).to.match(/multipart\/signed/); | |
expect(mail.message.childNodes).to.be.an('array'); | |
mail.message.build(function(err, message){ | |
fs.writeFileSync(path.join(__dirname, 'out3.email'), message, 'binary') | |
}); | |
done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment