mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
fix(Gmail Node): Set References and In-Reply-To only when user provides threadId (#16838)
This commit is contained in:
@@ -143,8 +143,8 @@ describe('addThreadHeadersToEmail', () => {
|
||||
const mockMessageId = '<message-id@example.com>';
|
||||
const mockThread = {
|
||||
messages: [
|
||||
{ payload: { headers: [{ value: '<old-id@example.com>' }] } },
|
||||
{ payload: { headers: [{ value: mockMessageId }] } },
|
||||
{ payload: { headers: [{ name: 'Message-ID', value: '<old-id@example.com>' }] } },
|
||||
{ payload: { headers: [{ name: 'Message-ID', value: mockMessageId }] } },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -159,14 +159,14 @@ describe('addThreadHeadersToEmail', () => {
|
||||
await addThreadHeadersToEmail.call(thisArg, email, mockThreadId);
|
||||
|
||||
expect(email.inReplyTo).toBe(mockMessageId);
|
||||
expect(email.reference).toBe(mockMessageId);
|
||||
expect(email.references).toBe(mockMessageId);
|
||||
});
|
||||
|
||||
it('should set inReplyTo and reference on the email object even if the message has only one item', async () => {
|
||||
const mockThreadId = 'thread123';
|
||||
const mockMessageId = '<message-id@example.com>';
|
||||
const mockThread = {
|
||||
messages: [{ payload: { headers: [{ value: mockMessageId }] } }],
|
||||
messages: [{ payload: { headers: [{ name: 'Message-ID', value: mockMessageId }] } }],
|
||||
};
|
||||
|
||||
jest.spyOn(GenericFunctions, 'googleApiRequest').mockImplementation(async function () {
|
||||
@@ -180,7 +180,7 @@ describe('addThreadHeadersToEmail', () => {
|
||||
await addThreadHeadersToEmail.call(thisArg, email, mockThreadId);
|
||||
|
||||
expect(email.inReplyTo).toBe(mockMessageId);
|
||||
expect(email.reference).toBe(mockMessageId);
|
||||
expect(email.references).toBe(mockMessageId);
|
||||
});
|
||||
|
||||
it('should not do anything if the thread has no messages', async () => {
|
||||
@@ -199,6 +199,6 @@ describe('addThreadHeadersToEmail', () => {
|
||||
|
||||
// We are using mock<IEmail>({}) which means the value of these will be a mock function
|
||||
expect(typeof email.inReplyTo).toBe('function');
|
||||
expect(typeof email.reference).toBe('function');
|
||||
expect(typeof email.references).toBe('function');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user