Correctly type things that interact with nodemailer.
This commit is contained in:
parent
1dc52cfa75
commit
81c404f88d
|
@ -1,3 +1,4 @@
|
|||
import { SendEmailResponse } from "@budibase/types"
|
||||
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
|
||||
import * as workerRequests from "../../../utilities/workerRequests"
|
||||
|
||||
|
@ -5,17 +6,18 @@ jest.mock("../../../utilities/workerRequests", () => ({
|
|||
sendSmtpEmail: jest.fn(),
|
||||
}))
|
||||
|
||||
function generateResponse(to: string, from: string) {
|
||||
function generateResponse(to: string, from: string): SendEmailResponse {
|
||||
return {
|
||||
success: true,
|
||||
response: {
|
||||
message: `Email sent to ${to}.`,
|
||||
accepted: [to],
|
||||
envelope: {
|
||||
from: from,
|
||||
to: [to],
|
||||
},
|
||||
message: `Email sent to ${to}.`,
|
||||
},
|
||||
messageId: "messageId",
|
||||
pending: [],
|
||||
rejected: [],
|
||||
response: "response",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"@budibase/nano": "10.1.5",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/koa": "2.13.4",
|
||||
"@types/nodemailer": "^6.4.17",
|
||||
"@types/redlock": "4.0.7",
|
||||
"koa-useragent": "^4.1.0",
|
||||
"rimraf": "3.0.2",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { EmailAttachment, EmailInvite } from "../../../documents"
|
||||
import SMTPTransport from "nodemailer/lib/smtp-transport"
|
||||
|
||||
export enum EmailTemplatePurpose {
|
||||
CORE = "core",
|
||||
|
@ -23,6 +24,6 @@ export interface SendEmailRequest {
|
|||
invite?: EmailInvite
|
||||
attachments?: EmailAttachment[]
|
||||
}
|
||||
export interface SendEmailResponse extends Record<string, any> {
|
||||
export interface SendEmailResponse extends SMTPTransport.SentMessageInfo {
|
||||
message: string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue