tests in typescript

This commit is contained in:
grimhilt
2023-04-01 22:36:51 +02:00
parent 9fbf5e5cf3
commit a5d325818b
22 changed files with 1258 additions and 412 deletions

View File

@@ -1,5 +1,5 @@
import { getAddresseId } from "../db/mail";
import mailParser from "mailparser";
import {simpleParser} from "mailparser";
import moment from "moment";
import {
registerMessage,
@@ -41,7 +41,7 @@ export function saveMessage(attrs, mailboxId, imap) {
// saveSource(messageId, buffer);
// parse data
mailParser(buffer, async (err, parsed) => {
simpleParser(buffer, async (err, parsed) => {
saveFromParsedData(parsed, messageId)
.then(() => {
resolve(messageId);
@@ -68,7 +68,7 @@ export function saveMessage(attrs, mailboxId, imap) {
}
async function saveFromParsedData(parsed, messageId) {
const promises = [];
const promises: Promise<any>[] = [];
Object.keys(parsed).forEach((key) => {
if (["from", "to", "cc", "bcc", "replyTo"].includes(key)) {
promises.push(