feat(Email Trigger (IMAP) Node): IMAP trigger node returns message UIDs (#13152)

This commit is contained in:
umanamente
2025-04-08 00:54:59 -07:00
committed by GitHub
parent 7463f0c18a
commit 457870953a
2 changed files with 13 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ describe('Test IMap V2 utils', () => {
const message = { const message = {
attributes: { attributes: {
uuid: 1, uuid: 1,
uid: 873,
struct: {}, struct: {},
}, },
parts: [ parts: [
@@ -25,7 +26,6 @@ describe('Test IMap V2 utils', () => {
], ],
}; };
const staticData: IDataObject = {};
const imapConnection = mock<ImapSimple>({ const imapConnection = mock<ImapSimple>({
search: jest.fn().mockReturnValue(Promise.resolve([message])), search: jest.fn().mockReturnValue(Promise.resolve([message])),
}); });
@@ -42,6 +42,9 @@ describe('Test IMap V2 utils', () => {
headers: { '': 'Body content' }, headers: { '': 'Body content' },
headerLines: undefined, headerLines: undefined,
html: false, html: false,
attributes: {
uid: 873,
},
}, },
binary: undefined, binary: undefined,
}, },
@@ -55,6 +58,9 @@ describe('Test IMap V2 utils', () => {
metadata: { metadata: {
'0': 'h', '0': 'h',
}, },
attributes: {
uid: 873,
},
}, },
}, },
}, },
@@ -67,6 +73,9 @@ describe('Test IMap V2 utils', () => {
]; ];
expectedResults.forEach(async (expectedResult) => { expectedResults.forEach(async (expectedResult) => {
// use new staticData for each iteration
const staticData: IDataObject = {};
triggerFunctions.getNodeParameter triggerFunctions.getNodeParameter
.calledWith('format') .calledWith('format')
.mockReturnValue(expectedResult.format); .mockReturnValue(expectedResult.format);

View File

@@ -149,6 +149,9 @@ export async function getNewEmails(
textHtml: await getText(parts, message, 'html'), textHtml: await getText(parts, message, 'html'),
textPlain: await getText(parts, message, 'plain'), textPlain: await getText(parts, message, 'plain'),
metadata: {} as IDataObject, metadata: {} as IDataObject,
attributes: {
uid: message.attributes.uid,
} as IDataObject,
}, },
}; };