chore: fix nits

This commit is contained in:
Zack Schuster 2022-05-11 16:35:21 -07:00
parent 8503c7f63a
commit 8706678fbc
3 changed files with 13 additions and 18 deletions

View File

@ -163,7 +163,7 @@ export class Message {
this.header.subject = mimeWordEncode(headers.subject as string);
} else if (/^(cc|bcc|to|from)/i.test(header)) {
this.header[header.toLowerCase()] = convertPersonToAddress(
headers[header] as string | string[]
headers[header as 'cc' | 'bcc' | 'to' | 'from'] ?? ''
);
} else {
// allow any headers the user wants to set??

View File

@ -17,7 +17,7 @@ function connect({
return new Promise<void>((resolve, reject) => {
const server = new SMTPServer({
authMethods,
secure: secure,
secure,
onAuth(auth, _session, callback) {
const { accessToken, method, username, password } = auth;
if (

View File

@ -84,23 +84,18 @@ test('synchronous queue failures are handled gracefully by client', async (t) =>
})
);
// @ts-expect-error need to check protected prop
const { ready, sending, smtp } = tlsClient;
const state = smtp.state();
t.log(
`SMTPClient ${JSON.stringify(
{
// @ts-expect-error need to check protected prop
ready: tlsClient.ready,
// @ts-expect-error need to check protected prop
sending: tlsClient.sending,
state: tlsClient.smtp.state(),
},
null,
'\t'
).replace(/"/g, '')}`
`SMTPClient ${JSON.stringify({ ready, sending, state }, null, '\t').replace(
/"/g,
''
)}`
);
// @ts-expect-error need to check protected prop
t.false(tlsClient.ready);
// @ts-expect-error need to check protected prop
t.false(tlsClient.sending);
t.is(tlsClient.smtp.state(), 0);
t.false(ready);
t.false(sending);
t.is(state, 0);
});