1
0
mirror of https://github.com/eleith/emailjs.git synced 2024-07-02 11:08:51 +00:00

test/auth: use AUTH_METHODS enum

This commit is contained in:
Zack Schuster 2020-05-27 08:59:43 -07:00
parent 72feca9a01
commit 8f1f9effc5

View File

@ -7,7 +7,7 @@ import {
SMTPServerSession, SMTPServerSession,
} from 'smtp-server'; } from 'smtp-server';
import { Client, Message } from '../email'; import { AUTH_METHODS, Client, Message } from '../email';
function onAuth( function onAuth(
auth: SMTPServerAuthentication, auth: SMTPServerAuthentication,
@ -100,7 +100,7 @@ test.cb('PLAIN authentication (unencrypted) should succeed', (t) => {
text: "It is hard to be brave when you're only a Very Small Animal.", text: "It is hard to be brave when you're only a Very Small Animal.",
}; };
server = new SMTPServer({ server = new SMTPServer({
authMethods: ['PLAIN'], authMethods: [AUTH_METHODS.PLAIN],
hideSTARTTLS: true, hideSTARTTLS: true,
onAuth, onAuth,
onData(stream, _session, callback: () => void) { onData(stream, _session, callback: () => void) {
@ -120,7 +120,7 @@ test.cb('PLAIN authentication (unencrypted) should succeed', (t) => {
port, port,
user: 'pooh', user: 'pooh',
password: 'honey', password: 'honey',
authentication: ['PLAIN'], authentication: [AUTH_METHODS.PLAIN],
}).send(new Message(msg), (err) => { }).send(new Message(msg), (err) => {
if (err) { if (err) {
throw err; throw err;
@ -137,7 +137,7 @@ test.cb('PLAIN authentication (encrypted) should succeed', (t) => {
text: "It is hard to be brave when you're only a Very Small Animal.", text: "It is hard to be brave when you're only a Very Small Animal.",
}; };
server = new SMTPServer({ server = new SMTPServer({
authMethods: ['PLAIN'], authMethods: [AUTH_METHODS.PLAIN],
secure: true, secure: true,
onAuth, onAuth,
onData(stream, _session, callback: () => void) { onData(stream, _session, callback: () => void) {
@ -157,7 +157,7 @@ test.cb('PLAIN authentication (encrypted) should succeed', (t) => {
port, port,
user: 'pooh', user: 'pooh',
password: 'honey', password: 'honey',
authentication: ['PLAIN'], authentication: [AUTH_METHODS.PLAIN],
ssl: true, ssl: true,
}).send(new Message(msg), (err) => { }).send(new Message(msg), (err) => {
if (err) { if (err) {
@ -175,7 +175,7 @@ test.cb('LOGIN authentication (unencrypted) should succeed', (t) => {
text: "It is hard to be brave when you're only a Very Small Animal.", text: "It is hard to be brave when you're only a Very Small Animal.",
}; };
server = new SMTPServer({ server = new SMTPServer({
authMethods: ['LOGIN'], authMethods: [AUTH_METHODS.LOGIN],
hideSTARTTLS: true, hideSTARTTLS: true,
onAuth, onAuth,
onData(stream, _session, callback: () => void) { onData(stream, _session, callback: () => void) {
@ -195,7 +195,7 @@ test.cb('LOGIN authentication (unencrypted) should succeed', (t) => {
port, port,
user: 'pooh', user: 'pooh',
password: 'honey', password: 'honey',
authentication: ['LOGIN'], authentication: [AUTH_METHODS.LOGIN],
}).send(new Message(msg), (err) => { }).send(new Message(msg), (err) => {
if (err) { if (err) {
throw err; throw err;
@ -212,7 +212,7 @@ test.cb('LOGIN authentication (encrypted) should succeed', (t) => {
text: "It is hard to be brave when you're only a Very Small Animal.", text: "It is hard to be brave when you're only a Very Small Animal.",
}; };
server = new SMTPServer({ server = new SMTPServer({
authMethods: ['LOGIN'], authMethods: [AUTH_METHODS.LOGIN],
secure: true, secure: true,
onAuth, onAuth,
onData(stream, _session, callback: () => void) { onData(stream, _session, callback: () => void) {
@ -233,7 +233,7 @@ test.cb('LOGIN authentication (encrypted) should succeed', (t) => {
user: 'pooh', user: 'pooh',
password: 'honey', password: 'honey',
ssl: true, ssl: true,
authentication: ['LOGIN'], authentication: [AUTH_METHODS.LOGIN],
}).send(new Message(msg), (err) => { }).send(new Message(msg), (err) => {
if (err) { if (err) {
throw err; throw err;