mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix tests
This commit is contained in:
@@ -65,10 +65,15 @@ const knownHostsTransport = function(settings = undefined, url = undefined) {
|
||||
host = urlObject.hostname;
|
||||
user = urlObject.username;
|
||||
password = urlObject.password;
|
||||
} else if (urlObject.protocol && urlObject.username && urlObject.password) {
|
||||
// We have some data from urlObject
|
||||
host = urlObject.protocol.split(':')[0];
|
||||
user = urlObject.username;
|
||||
password = urlObject.password;
|
||||
} else {
|
||||
// We need to disect the URL ourselves to get the data
|
||||
// First get rid of the leading '//' and split to username and the rest
|
||||
const temp = urlObject.pathname.substring(2).split(':');
|
||||
const temp = urlObject.pathname.substring(2)?.split(':');
|
||||
user = temp[0];
|
||||
// Now we split by '@' to get password and hostname
|
||||
const temp2 = temp[1].split('@');
|
||||
|
||||
@@ -255,7 +255,7 @@ Tinytest.add("email - alternate API is used for sending gets data", function(tes
|
||||
Meteor.settings.packages = { email: { service: '1on1', user: 'test', password: 'pwd' } };
|
||||
Email.customTransport = (options) => {
|
||||
test.equal(options.from, 'foo@example.com');
|
||||
test.equal(options.settings?.service, '1on1');
|
||||
test.equal(options.packageSettings?.service, '1on1');
|
||||
};
|
||||
|
||||
Email.send({
|
||||
@@ -283,13 +283,13 @@ Tinytest.add("email - URL string for known hosts", function(test) {
|
||||
const outlookTransport2 = EmailTest.knowHostsTransport(undefined, 'Outlook365://firstname.lastname@hotmail.com:password@hotmail.com');
|
||||
test.equal(outlookTransport.transporter.auth.user, 'firstname.lastname%40hotmail.com');
|
||||
test.equal(outlookTransport.options.auth.user, 'firstname.lastname%40hotmail.com');
|
||||
test.equal(outlookTransport.transporter.options.service, 'hotmail.com');
|
||||
test.equal(outlookTransport.transporter.options.service, 'outlook365');
|
||||
test.equal(outlookTransport2.transporter.auth.user, 'firstname.lastname%40hotmail.com');
|
||||
test.equal(outlookTransport2.transporter.options.service, 'hotmail.com');
|
||||
test.equal(outlookTransport2.transporter.options.service, 'outlook365');
|
||||
|
||||
const hotmailTransport = EmailTest.knowHostsTransport(undefined, 'Hotmail://firstname.lastname@hotmail.com:password@hotmail.com');
|
||||
console.dir(hotmailTransport);
|
||||
test.equal(hotmailTransport.transporter.options.service, 'hotmail.com');
|
||||
test.equal(hotmailTransport.transporter.options.service, 'hotmail');
|
||||
|
||||
const falseService = { service: '1on1', user: 'test', password: 'pwd' };
|
||||
const errorMsg = 'Could not recognize e-mail service. See list at https://nodemailer.com/smtp/well-known/ for services that we can configure for you.';
|
||||
|
||||
Reference in New Issue
Block a user