first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => get', () => {
|
||||
const credentials = {
|
||||
microsoftOutlookOAuth2Api: {
|
||||
accessToken: 'test-access-token',
|
||||
refreshToken: 'test-refresh-token',
|
||||
},
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
const messageId =
|
||||
'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=';
|
||||
|
||||
nock('https://graph.microsoft.com')
|
||||
.get(`/v1.0/me/messages/${messageId}`)
|
||||
.query({
|
||||
$select:
|
||||
'id,conversationId,subject,bodyPreview,from,toRecipients,categories,hasAttachments',
|
||||
})
|
||||
.reply(200, {
|
||||
'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/messages/$entity',
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKec"',
|
||||
id: messageId,
|
||||
conversationId:
|
||||
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=',
|
||||
subject: 'Test Email Subject',
|
||||
bodyPreview: 'This is a test email body preview for the get operation',
|
||||
from: {
|
||||
emailAddress: {
|
||||
name: 'John Doe',
|
||||
address: 'john.doe@example.com',
|
||||
},
|
||||
},
|
||||
toRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'Jane Smith',
|
||||
address: 'jane.smith@example.com',
|
||||
},
|
||||
},
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'Bob Wilson',
|
||||
address: 'bob.wilson@example.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
categories: ['Blue category', 'Important'],
|
||||
hasAttachments: true,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['get.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "Microsoft Outlook Message Get Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "get",
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
|
||||
"mode": "id"
|
||||
},
|
||||
"output": "simple"
|
||||
},
|
||||
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
|
||||
"name": "Microsoft Outlook",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"typeVersion": 2,
|
||||
"position": [1040, 360],
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "iXJCki7i5Vz0bdks",
|
||||
"name": "Microsoft Outlook OAuth2 Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Microsoft Outlook": [
|
||||
{
|
||||
"json": {
|
||||
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
|
||||
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=",
|
||||
"subject": "Test Email Subject",
|
||||
"bodyPreview": "This is a test email body preview for the get operation",
|
||||
"from": "john.doe@example.com",
|
||||
"to": ["jane.smith@example.com", "bob.wilson@example.com"],
|
||||
"categories": ["Blue category", "Important"],
|
||||
"hasAttachments": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => getAll', () => {
|
||||
const credentials = {
|
||||
microsoftOutlookOAuth2Api: {
|
||||
accessToken: 'test-access-token',
|
||||
refreshToken: 'test-refresh-token',
|
||||
},
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.get('/v1.0/me/messages')
|
||||
.query({
|
||||
$select:
|
||||
'id,conversationId,subject,bodyPreview,from,toRecipients,categories,hasAttachments',
|
||||
$top: 50,
|
||||
})
|
||||
.reply(200, {
|
||||
'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/messages',
|
||||
value: [
|
||||
{
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKec"',
|
||||
id: 'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=',
|
||||
conversationId:
|
||||
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=',
|
||||
subject: 'Test Email 1',
|
||||
bodyPreview: 'This is the first test email body preview',
|
||||
from: {
|
||||
emailAddress: {
|
||||
name: 'John Doe',
|
||||
address: 'john.doe@example.com',
|
||||
},
|
||||
},
|
||||
toRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'Jane Smith',
|
||||
address: 'jane.smith@example.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
categories: ['Blue category'],
|
||||
hasAttachments: false,
|
||||
},
|
||||
{
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFSpKed"',
|
||||
id: 'AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKedAAA=',
|
||||
conversationId:
|
||||
'AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFt=',
|
||||
subject: 'Test Email 2',
|
||||
bodyPreview: 'This is the second test email body preview',
|
||||
from: {
|
||||
emailAddress: {
|
||||
name: 'Alice Johnson',
|
||||
address: 'alice.johnson@example.com',
|
||||
},
|
||||
},
|
||||
toRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'Bob Wilson',
|
||||
address: 'bob.wilson@example.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
categories: ['Red category'],
|
||||
hasAttachments: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "Microsoft Outlook Message Get All Test",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "getAll",
|
||||
"returnAll": false,
|
||||
"limit": 50,
|
||||
"output": "simple"
|
||||
},
|
||||
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
|
||||
"name": "Microsoft Outlook",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"typeVersion": 2,
|
||||
"position": [1040, 360],
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "iXJCki7i5Vz0bdks",
|
||||
"name": "Microsoft Outlook OAuth2 Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Microsoft Outlook": [
|
||||
{
|
||||
"json": {
|
||||
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKecAAA=",
|
||||
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFs=",
|
||||
"subject": "Test Email 1",
|
||||
"bodyPreview": "This is the first test email body preview",
|
||||
"from": "john.doe@example.com",
|
||||
"to": ["jane.smith@example.com"],
|
||||
"categories": ["Blue category"],
|
||||
"hasAttachments": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "AAMkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgBGAAAAAAA_iGOFSpJvRJ8V0rRW_J9FBwBZf4De_LkrSqpPI8eyjUmAAAACEDdwAABZf4De_LkrSqpPI8eyjUmAAAFSpKedAAA=",
|
||||
"conversationId": "AAQkAGVmMDEzMTM4LTExMWMtNDAxYy05MWNjLWQ5YTY3NWUzNzE4ZgAQALc9G-OGBp9Hshu8JZGiSFt=",
|
||||
"subject": "Test Email 2",
|
||||
"bodyPreview": "This is the second test email body preview",
|
||||
"from": "alice.johnson@example.com",
|
||||
"to": ["bob.wilson@example.com"],
|
||||
"categories": ["Red category"],
|
||||
"hasAttachments": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => move', () => {
|
||||
nock('https://graph.microsoft.com/v1.0/me')
|
||||
.post(
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/move',
|
||||
{
|
||||
destinationId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=',
|
||||
},
|
||||
)
|
||||
.reply(200);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['move.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "My workflow 21",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
820,
|
||||
360
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "move",
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Hello",
|
||||
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEJAABZf4De%2FLkrSqpPI8eyjUmAAAFXBEVwAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
|
||||
},
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Folder 42",
|
||||
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEHAAA%3D"
|
||||
}
|
||||
},
|
||||
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
|
||||
"name": "Microsoft Outlook",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1040,
|
||||
360
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "iXJCki7i5Vz0bdks",
|
||||
"name": "Microsoft Outlook account 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Microsoft Outlook": [
|
||||
{
|
||||
"json": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "1434b547-7141-4650-8dce-333dda26e092",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => reply', () => {
|
||||
nock('https://graph.microsoft.com/v1.0/me')
|
||||
.post(
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/createReply',
|
||||
{
|
||||
message: {
|
||||
body: { content: 'Reply message', contentType: 'html' },
|
||||
importance: 'High',
|
||||
subject: 'Reply Subject',
|
||||
},
|
||||
},
|
||||
)
|
||||
.reply(200, {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+"',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=',
|
||||
createdDateTime: '2023-09-04T12:29:59Z',
|
||||
lastModifiedDateTime: '2023-09-04T12:29:59Z',
|
||||
changeKey: 'CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+',
|
||||
categories: [],
|
||||
receivedDateTime: '2023-09-04T12:29:59Z',
|
||||
sentDateTime: '2023-09-04T12:29:59Z',
|
||||
hasAttachments: false,
|
||||
internetMessageId:
|
||||
'<AM0PR10MB2100903A148F1623165004E3DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>',
|
||||
subject: 'Reply Subject',
|
||||
bodyPreview: 'Reply message',
|
||||
importance: 'high',
|
||||
parentFolderId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=',
|
||||
conversationId:
|
||||
'AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKwkQLinj69KtoFOxMG2lVY=',
|
||||
conversationIndex: 'AQHZ3yq3rCRAuKePr0q2gU7EwbaVVrAKmLQ4',
|
||||
isDeliveryReceiptRequested: false,
|
||||
isReadReceiptRequested: false,
|
||||
isRead: true,
|
||||
isDraft: true,
|
||||
webLink:
|
||||
'https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDurAAA%3D&exvsurl=1&viewmodel=ReadMessageItem',
|
||||
inferenceClassification: 'focused',
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'<html><head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>Reply message </body></html>',
|
||||
},
|
||||
sender: {
|
||||
emailAddress: {
|
||||
name: 'Michael Kret',
|
||||
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
|
||||
},
|
||||
},
|
||||
from: {
|
||||
emailAddress: {
|
||||
name: 'Michael Kret',
|
||||
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
|
||||
},
|
||||
},
|
||||
toRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'reply@mail.com',
|
||||
address: 'reply@mail.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
ccRecipients: [],
|
||||
bccRecipients: [],
|
||||
replyTo: [],
|
||||
flag: {
|
||||
flagStatus: 'notFlagged',
|
||||
},
|
||||
})
|
||||
.post(
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=/send',
|
||||
)
|
||||
.reply(200);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['reply.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"name": "My workflow 21",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
820,
|
||||
360
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "reply",
|
||||
"messageId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Hello",
|
||||
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEJAABZf4De%2FLkrSqpPI8eyjUmAAAFXBEVwAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
|
||||
},
|
||||
"replyToSenderOnly": true,
|
||||
"message": "Reply message",
|
||||
"additionalFields": {
|
||||
"importance": "High",
|
||||
"bodyContentType": "html",
|
||||
"subject": "Reply Subject"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
|
||||
"name": "Microsoft Outlook",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1040,
|
||||
360
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "iXJCki7i5Vz0bdks",
|
||||
"name": "Microsoft Outlook account 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Microsoft Outlook": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
|
||||
"@odata.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=",
|
||||
"createdDateTime": "2023-09-04T12:29:59Z",
|
||||
"lastModifiedDateTime": "2023-09-04T12:29:59Z",
|
||||
"changeKey": "CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CX+",
|
||||
"categories": [],
|
||||
"receivedDateTime": "2023-09-04T12:29:59Z",
|
||||
"sentDateTime": "2023-09-04T12:29:59Z",
|
||||
"hasAttachments": false,
|
||||
"internetMessageId": "<AM0PR10MB2100903A148F1623165004E3DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>",
|
||||
"subject": "Reply Subject",
|
||||
"bodyPreview": "Reply message",
|
||||
"importance": "high",
|
||||
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=",
|
||||
"conversationId": "AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKwkQLinj69KtoFOxMG2lVY=",
|
||||
"conversationIndex": "AQHZ3yq3rCRAuKePr0q2gU7EwbaVVrAKmLQ4",
|
||||
"isDeliveryReceiptRequested": false,
|
||||
"isReadReceiptRequested": false,
|
||||
"isRead": true,
|
||||
"isDraft": true,
|
||||
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDurAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
|
||||
"inferenceClassification": "focused",
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "<html><head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>Reply message </body></html>"
|
||||
},
|
||||
"sender": {
|
||||
"emailAddress": {
|
||||
"name": "Michael Kret",
|
||||
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
|
||||
}
|
||||
},
|
||||
"from": {
|
||||
"emailAddress": {
|
||||
"name": "Michael Kret",
|
||||
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
|
||||
}
|
||||
},
|
||||
"toRecipients": [
|
||||
{
|
||||
"emailAddress": {
|
||||
"name": "reply@mail.com",
|
||||
"address": "reply@mail.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ccRecipients": [],
|
||||
"bccRecipients": [],
|
||||
"replyTo": [],
|
||||
"flag": {
|
||||
"flagStatus": "notFlagged"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "edd34dd1-0321-4d5b-a935-0c47d4c746b8",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => send', () => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.post('/v1.0/me/sendMail', {
|
||||
message: {
|
||||
body: { content: 'message description', contentType: 'Text' },
|
||||
replyTo: [{ emailAddress: { address: 'reply@mail.com' } }],
|
||||
subject: 'Hello',
|
||||
toRecipients: [{ emailAddress: { address: 'to@mail.com' } }],
|
||||
},
|
||||
saveToSentItems: true,
|
||||
})
|
||||
.reply(200, {});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['send.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "My workflow 21",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "e524f588-b6a3-4849-8777-b32a8a755ae5",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
820,
|
||||
360
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"toRecipients": "to@mail.com",
|
||||
"subject": "Hello",
|
||||
"bodyContent": "message description",
|
||||
"additionalFields": {
|
||||
"bodyContentType": "Text",
|
||||
"replyTo": "reply@mail.com"
|
||||
}
|
||||
},
|
||||
"id": "baff6798-0304-4255-bdb0-dd3f2659373b",
|
||||
"name": "Microsoft Outlook",
|
||||
"type": "n8n-nodes-base.microsoftOutlook",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1040,
|
||||
360
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftOutlookOAuth2Api": {
|
||||
"id": "iXJCki7i5Vz0bdks",
|
||||
"name": "Microsoft Outlook account 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"Microsoft Outlook": [
|
||||
{
|
||||
"json": {
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "fed8ec2e-8663-4dfc-8234-33eb83257260",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { MockProxy } from 'jest-mock-extended';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { SEND_AND_WAIT_OPERATION, type IExecuteFunctions } from 'n8n-workflow';
|
||||
|
||||
import { description } from '../../../../v2/actions/node.description';
|
||||
import { MicrosoftOutlookV2 } from '../../../../v2/MicrosoftOutlookV2.node';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => sendAndWait', () => {
|
||||
let microsoftOutlook: MicrosoftOutlookV2;
|
||||
let mockExecuteFunctions: MockProxy<IExecuteFunctions>;
|
||||
|
||||
beforeEach(() => {
|
||||
microsoftOutlook = new MicrosoftOutlookV2(description);
|
||||
mockExecuteFunctions = mock<IExecuteFunctions>();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should send message and put execution to wait', async () => {
|
||||
const items = [{ json: { data: 'test' } }];
|
||||
//router
|
||||
mockExecuteFunctions.getInputData.mockReturnValue(items);
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('message');
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce(SEND_AND_WAIT_OPERATION);
|
||||
mockExecuteFunctions.putExecutionToWait.mockImplementation();
|
||||
|
||||
//operation
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my@outlook.com');
|
||||
mockExecuteFunctions.getInstanceId.mockReturnValue('instanceId');
|
||||
|
||||
//getSendAndWaitConfig
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my message');
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('my subject');
|
||||
mockExecuteFunctions.getSignedResumeUrl.mockReturnValue(
|
||||
'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
|
||||
);
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); // approvalOptions
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); // options
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('approval');
|
||||
|
||||
// configureWaitTillDate
|
||||
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); //options.limitWaitTime.values
|
||||
|
||||
const result = await microsoftOutlook.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result).toEqual([items]);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(mockExecuteFunctions.putExecutionToWait).toHaveBeenCalledTimes(1);
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith('POST', '/sendMail', {
|
||||
message: {
|
||||
body: {
|
||||
content: expect.stringContaining(
|
||||
'href="http://localhost/waiting-webhook/nodeID?approved=true&signature=abc"',
|
||||
),
|
||||
contentType: 'html',
|
||||
},
|
||||
subject: 'my subject',
|
||||
toRecipients: [{ emailAddress: { address: 'my@outlook.com' } }],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user