feat(Microsoft Outlook Node): Node overhaul (#4449)
[N8N-4995](https://linear.app/n8n/issue/N8N-4995) --------- Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendarGroups('AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA%3D')/calendars/$entity",
|
||||
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAFXBBZ_AAA=',
|
||||
name: 'New Calendar',
|
||||
color: 'lightOrange',
|
||||
hexColor: '#fcab73',
|
||||
isDefaultCalendar: false,
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwWTA==',
|
||||
canShare: true,
|
||||
canViewPrivateItems: true,
|
||||
canEdit: true,
|
||||
allowedOnlineMeetingProviders: ['teamsForBusiness'],
|
||||
defaultOnlineMeetingProvider: 'teamsForBusiness',
|
||||
isTallyingResponses: false,
|
||||
isRemovable: true,
|
||||
owner: {
|
||||
name: 'User Name',
|
||||
address: 'test@mail.com',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, calendar => create', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/calendar/create.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/calendarGroups/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA=/calendars',
|
||||
{ color: 'lightOrange', name: 'New Calendar' },
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "calendar",
|
||||
"operation": "create",
|
||||
"name": "New Calendar",
|
||||
"additionalFields": {
|
||||
"calendarGroup": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA=",
|
||||
"color": "lightOrange"
|
||||
}
|
||||
},
|
||||
"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')/calendarGroups('AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRu_AAA%3D')/calendars/$entity",
|
||||
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAFXBBZ_AAA=",
|
||||
"name": "New Calendar",
|
||||
"color": "lightOrange",
|
||||
"hexColor": "#fcab73",
|
||||
"isDefaultCalendar": false,
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwWTA==",
|
||||
"canShare": true,
|
||||
"canViewPrivateItems": true,
|
||||
"canEdit": true,
|
||||
"allowedOnlineMeetingProviders": [
|
||||
"teamsForBusiness"
|
||||
],
|
||||
"defaultOnlineMeetingProvider": "teamsForBusiness",
|
||||
"isTallyingResponses": false,
|
||||
"isRemovable": true,
|
||||
"owner": {
|
||||
"name": "User Name",
|
||||
"address": "test@mail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "074cdbef-4193-45b8-970a-9f55b8a0999b",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'DELETE') {
|
||||
return {};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, calendar => delete', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/calendar/delete.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'DELETE',
|
||||
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvIAAA=',
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "calendar",
|
||||
"operation": "delete",
|
||||
"calendarId": {
|
||||
"__rl": true,
|
||||
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvIAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Foo"
|
||||
}
|
||||
},
|
||||
"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": "888e5578-c726-4a84-9658-321ba04fd0c7",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'GET') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
|
||||
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
|
||||
name: 'Foo Calendar',
|
||||
color: 'lightGreen',
|
||||
hexColor: '#87d28e',
|
||||
isDefaultCalendar: false,
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAAi67hiw==',
|
||||
canShare: true,
|
||||
canViewPrivateItems: true,
|
||||
canEdit: true,
|
||||
allowedOnlineMeetingProviders: ['teamsForBusiness'],
|
||||
defaultOnlineMeetingProvider: 'teamsForBusiness',
|
||||
isTallyingResponses: false,
|
||||
isRemovable: true,
|
||||
owner: {
|
||||
name: 'User Name',
|
||||
address: 'test@mail.com',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, calendar => get', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/calendar/get.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
|
||||
undefined,
|
||||
{},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "calendar",
|
||||
"operation": "get",
|
||||
"calendarId": {
|
||||
"__rl": true,
|
||||
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Foo Calendar"
|
||||
}
|
||||
},
|
||||
"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')/calendars/$entity",
|
||||
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
|
||||
"name": "Foo Calendar",
|
||||
"color": "lightGreen",
|
||||
"hexColor": "#87d28e",
|
||||
"isDefaultCalendar": false,
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAAi67hiw==",
|
||||
"canShare": true,
|
||||
"canViewPrivateItems": true,
|
||||
"canEdit": true,
|
||||
"allowedOnlineMeetingProviders": [
|
||||
"teamsForBusiness"
|
||||
],
|
||||
"defaultOnlineMeetingProvider": "teamsForBusiness",
|
||||
"isTallyingResponses": false,
|
||||
"isRemovable": true,
|
||||
"owner": {
|
||||
"name": "User Name",
|
||||
"address": "test@mail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "33e1fc57-ac36-453b-b01e-d79784b4a4bb",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'GET') {
|
||||
return {
|
||||
value: [
|
||||
{
|
||||
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=',
|
||||
name: 'Calendar',
|
||||
color: 'auto',
|
||||
hexColor: '',
|
||||
isDefaultCalendar: true,
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAACfdHfw==',
|
||||
canShare: true,
|
||||
canViewPrivateItems: true,
|
||||
canEdit: true,
|
||||
allowedOnlineMeetingProviders: ['teamsForBusiness'],
|
||||
defaultOnlineMeetingProvider: 'teamsForBusiness',
|
||||
isTallyingResponses: true,
|
||||
isRemovable: false,
|
||||
owner: {
|
||||
name: 'User Name',
|
||||
address: 'test@mail.com',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvBAAA=',
|
||||
name: 'Third calendar',
|
||||
color: 'lightYellow',
|
||||
hexColor: '#fde300',
|
||||
isDefaultCalendar: false,
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAAAi67hIw==',
|
||||
canShare: true,
|
||||
canViewPrivateItems: true,
|
||||
canEdit: true,
|
||||
allowedOnlineMeetingProviders: ['teamsForBusiness'],
|
||||
defaultOnlineMeetingProvider: 'teamsForBusiness',
|
||||
isTallyingResponses: false,
|
||||
isRemovable: true,
|
||||
owner: {
|
||||
name: 'User Name',
|
||||
address: 'test@mail.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, calendar => getAll', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/calendar/getAll.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith('GET', '/calendars', undefined, {
|
||||
$filter: 'canEdit eq true',
|
||||
$top: 2,
|
||||
});
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "calendar",
|
||||
"limit": 2,
|
||||
"filters": {
|
||||
"custom": "canEdit eq true"
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=",
|
||||
"name": "Calendar",
|
||||
"color": "auto",
|
||||
"hexColor": "",
|
||||
"isDefaultCalendar": true,
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAACfdHfw==",
|
||||
"canShare": true,
|
||||
"canViewPrivateItems": true,
|
||||
"canEdit": true,
|
||||
"allowedOnlineMeetingProviders": [
|
||||
"teamsForBusiness"
|
||||
],
|
||||
"defaultOnlineMeetingProvider": "teamsForBusiness",
|
||||
"isTallyingResponses": true,
|
||||
"isRemovable": false,
|
||||
"owner": {
|
||||
"name": "User Name",
|
||||
"address": "test@mail.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvBAAA=",
|
||||
"name": "Third calendar",
|
||||
"color": "lightYellow",
|
||||
"hexColor": "#fde300",
|
||||
"isDefaultCalendar": false,
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAAAi67hIw==",
|
||||
"canShare": true,
|
||||
"canViewPrivateItems": true,
|
||||
"canEdit": true,
|
||||
"allowedOnlineMeetingProviders": [
|
||||
"teamsForBusiness"
|
||||
],
|
||||
"defaultOnlineMeetingProvider": "teamsForBusiness",
|
||||
"isTallyingResponses": false,
|
||||
"isRemovable": true,
|
||||
"owner": {
|
||||
"name": "User Name",
|
||||
"address": "test@mail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "8f4e7775-0476-4506-a183-1365265b446a",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'PATCH') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars/$entity",
|
||||
id: 'AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
|
||||
name: 'Foo',
|
||||
color: 'lightOrange',
|
||||
hexColor: '#fcab73',
|
||||
isDefaultCalendar: false,
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwYKA==',
|
||||
canShare: true,
|
||||
canViewPrivateItems: true,
|
||||
canEdit: true,
|
||||
allowedOnlineMeetingProviders: ['teamsForBusiness'],
|
||||
defaultOnlineMeetingProvider: 'teamsForBusiness',
|
||||
isTallyingResponses: false,
|
||||
isRemovable: true,
|
||||
owner: {
|
||||
name: 'User Name',
|
||||
address: 'test@mail.com',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, calendar => update', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/calendar/update.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'PATCH',
|
||||
'/calendars/AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=',
|
||||
{ color: 'lightOrange', isDefaultCalendar: false, name: 'Foo' },
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "calendar",
|
||||
"operation": "update",
|
||||
"calendarId": {
|
||||
"__rl": true,
|
||||
"value": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Foo Calendar"
|
||||
},
|
||||
"updateFields": {
|
||||
"color": "lightOrange",
|
||||
"isDefaultCalendar": false,
|
||||
"name": "Foo"
|
||||
}
|
||||
},
|
||||
"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')/calendars/$entity",
|
||||
"id": "AAAXXXYYYnnnT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAACLtRvGAAA=",
|
||||
"name": "Foo",
|
||||
"color": "lightOrange",
|
||||
"hexColor": "#fcab73",
|
||||
"isDefaultCalendar": false,
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwYKA==",
|
||||
"canShare": true,
|
||||
"canViewPrivateItems": true,
|
||||
"canEdit": true,
|
||||
"allowedOnlineMeetingProviders": [
|
||||
"teamsForBusiness"
|
||||
],
|
||||
"defaultOnlineMeetingProvider": "teamsForBusiness",
|
||||
"isTallyingResponses": false,
|
||||
"isRemovable": true,
|
||||
"owner": {
|
||||
"name": "User Name",
|
||||
"address": "test@mail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "f8e68e5f-8c26-4c1f-b11b-8b4e4aeaa61f",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
|
||||
'@odata.etag': 'W/"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob"',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
|
||||
createdDateTime: '2023-09-04T08:48:39Z',
|
||||
lastModifiedDateTime: '2023-09-04T08:48:39Z',
|
||||
changeKey: 'EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob',
|
||||
categories: ['blue', 'green'],
|
||||
parentFolderId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=',
|
||||
birthday: '1991-09-19T11:59:00Z',
|
||||
fileAs: '',
|
||||
displayName: 'User Name',
|
||||
givenName: 'User',
|
||||
initials: null,
|
||||
middleName: null,
|
||||
nickName: null,
|
||||
surname: 'Name',
|
||||
title: 'Title',
|
||||
yomiGivenName: null,
|
||||
yomiSurname: null,
|
||||
yomiCompanyName: null,
|
||||
generation: null,
|
||||
imAddresses: [],
|
||||
jobTitle: null,
|
||||
companyName: 'Company',
|
||||
department: 'IT',
|
||||
officeLocation: null,
|
||||
profession: null,
|
||||
businessHomePage: null,
|
||||
assistantName: 'Assistant',
|
||||
manager: null,
|
||||
homePhones: [],
|
||||
mobilePhone: null,
|
||||
businessPhones: [],
|
||||
spouseName: null,
|
||||
personalNotes: '',
|
||||
children: [],
|
||||
emailAddresses: [],
|
||||
homeAddress: {},
|
||||
businessAddress: {},
|
||||
otherAddress: {},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, contact => create', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/contact/create.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith('POST', '/contacts', {
|
||||
assistantName: 'Assistant',
|
||||
birthday: '1991-09-19T21:00:00.000Z',
|
||||
categories: ['blue', 'green'],
|
||||
companyName: 'Company',
|
||||
department: 'IT',
|
||||
displayName: 'User Name',
|
||||
givenName: 'User',
|
||||
surname: 'Name',
|
||||
title: 'Title',
|
||||
});
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "contact",
|
||||
"operation": "create",
|
||||
"givenName": "User",
|
||||
"surname": "Name",
|
||||
"additionalFields": {
|
||||
"assistantName": "Assistant",
|
||||
"birthday": "1991-09-19T21:00:00.000Z",
|
||||
"categories": "blue, green",
|
||||
"companyName": "Company",
|
||||
"department": "IT",
|
||||
"displayName": "User Name",
|
||||
"title": "Title"
|
||||
}
|
||||
},
|
||||
"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')/contacts/$entity",
|
||||
"@odata.etag": "W/\"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
|
||||
"createdDateTime": "2023-09-04T08:48:39Z",
|
||||
"lastModifiedDateTime": "2023-09-04T08:48:39Z",
|
||||
"changeKey": "EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bob",
|
||||
"categories": [
|
||||
"blue",
|
||||
"green"
|
||||
],
|
||||
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=",
|
||||
"birthday": "1991-09-19T11:59:00Z",
|
||||
"fileAs": "",
|
||||
"displayName": "User Name",
|
||||
"givenName": "User",
|
||||
"initials": null,
|
||||
"middleName": null,
|
||||
"nickName": null,
|
||||
"surname": "Name",
|
||||
"title": "Title",
|
||||
"yomiGivenName": null,
|
||||
"yomiSurname": null,
|
||||
"yomiCompanyName": null,
|
||||
"generation": null,
|
||||
"imAddresses": [],
|
||||
"jobTitle": null,
|
||||
"companyName": "Company",
|
||||
"department": "IT",
|
||||
"officeLocation": null,
|
||||
"profession": null,
|
||||
"businessHomePage": null,
|
||||
"assistantName": "Assistant",
|
||||
"manager": null,
|
||||
"homePhones": [],
|
||||
"mobilePhone": null,
|
||||
"businessPhones": [],
|
||||
"spouseName": null,
|
||||
"personalNotes": "",
|
||||
"children": [],
|
||||
"emailAddresses": [],
|
||||
"homeAddress": {},
|
||||
"businessAddress": {},
|
||||
"otherAddress": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "51df88ff-b679-43df-9129-d1b26ea6b82d",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'PATCH') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/contacts/$entity",
|
||||
'@odata.etag': 'W/"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou"',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
|
||||
createdDateTime: '2023-09-04T08:48:39Z',
|
||||
lastModifiedDateTime: '2023-09-04T09:06:21Z',
|
||||
changeKey: 'EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou',
|
||||
categories: ['blue', 'green'],
|
||||
parentFolderId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=',
|
||||
birthday: '1991-09-19T11:59:00Z',
|
||||
fileAs: '',
|
||||
displayName: 'Username',
|
||||
givenName: 'User',
|
||||
initials: null,
|
||||
middleName: null,
|
||||
nickName: null,
|
||||
surname: 'Name',
|
||||
title: 'Title',
|
||||
yomiGivenName: null,
|
||||
yomiSurname: null,
|
||||
yomiCompanyName: null,
|
||||
generation: null,
|
||||
imAddresses: [],
|
||||
jobTitle: null,
|
||||
companyName: 'Company',
|
||||
department: 'IT',
|
||||
officeLocation: null,
|
||||
profession: null,
|
||||
businessHomePage: null,
|
||||
assistantName: 'Assistant',
|
||||
manager: 'Manager',
|
||||
homePhones: [],
|
||||
mobilePhone: '',
|
||||
businessPhones: ['999000555777'],
|
||||
spouseName: '',
|
||||
personalNotes: '',
|
||||
children: [],
|
||||
emailAddresses: [],
|
||||
homeAddress: {},
|
||||
businessAddress: {
|
||||
street: 'Street',
|
||||
city: 'City',
|
||||
state: 'State',
|
||||
countryOrRegion: 'Country',
|
||||
postalCode: '777777',
|
||||
},
|
||||
otherAddress: {},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, contact => update', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/contact/update.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'PATCH',
|
||||
'/contacts/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=',
|
||||
{
|
||||
businessAddress: {
|
||||
city: 'City',
|
||||
countryOrRegion: 'Country',
|
||||
postalCode: '777777',
|
||||
state: 'State',
|
||||
street: 'Street',
|
||||
},
|
||||
businessPhones: ['999000555777'],
|
||||
displayName: 'Username',
|
||||
manager: 'Manager',
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "contact",
|
||||
"operation": "update",
|
||||
"contactId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "User Name"
|
||||
},
|
||||
"additionalFields": {
|
||||
"businessAddress": {
|
||||
"values": {
|
||||
"city": "City",
|
||||
"countryOrRegion": "Country",
|
||||
"postalCode": "777777",
|
||||
"state": "State",
|
||||
"street": "Street"
|
||||
}
|
||||
},
|
||||
"businessPhones": "999000555777",
|
||||
"displayName": "Username",
|
||||
"manager": "Manager"
|
||||
}
|
||||
},
|
||||
"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')/contacts/$entity",
|
||||
"@odata.etag": "W/\"EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAABZf4De-LkrSqpPI8eyjUmAAAFXBCQuAAA=",
|
||||
"createdDateTime": "2023-09-04T08:48:39Z",
|
||||
"lastModifiedDateTime": "2023-09-04T09:06:21Z",
|
||||
"changeKey": "EQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bou",
|
||||
"categories": [
|
||||
"blue",
|
||||
"green"
|
||||
],
|
||||
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEOAAA=",
|
||||
"birthday": "1991-09-19T11:59:00Z",
|
||||
"fileAs": "",
|
||||
"displayName": "Username",
|
||||
"givenName": "User",
|
||||
"initials": null,
|
||||
"middleName": null,
|
||||
"nickName": null,
|
||||
"surname": "Name",
|
||||
"title": "Title",
|
||||
"yomiGivenName": null,
|
||||
"yomiSurname": null,
|
||||
"yomiCompanyName": null,
|
||||
"generation": null,
|
||||
"imAddresses": [],
|
||||
"jobTitle": null,
|
||||
"companyName": "Company",
|
||||
"department": "IT",
|
||||
"officeLocation": null,
|
||||
"profession": null,
|
||||
"businessHomePage": null,
|
||||
"assistantName": "Assistant",
|
||||
"manager": "Manager",
|
||||
"homePhones": [],
|
||||
"mobilePhone": "",
|
||||
"businessPhones": [
|
||||
"999000555777"
|
||||
],
|
||||
"spouseName": "",
|
||||
"personalNotes": "",
|
||||
"children": [],
|
||||
"emailAddresses": [],
|
||||
"homeAddress": {},
|
||||
"businessAddress": {
|
||||
"street": "Street",
|
||||
"city": "City",
|
||||
"state": "State",
|
||||
"countryOrRegion": "Country",
|
||||
"postalCode": "777777"
|
||||
},
|
||||
"otherAddress": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "842587ce-f153-49ac-8818-d173d4d6aac6",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2"',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=',
|
||||
createdDateTime: '2023-09-04T09:18:35Z',
|
||||
lastModifiedDateTime: '2023-09-04T09:18:35Z',
|
||||
changeKey: 'CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2',
|
||||
categories: [
|
||||
'd10cd8f9-14ac-460e-a6ec-c40dd1876ea2',
|
||||
'6844a34e-4d23-4805-9fec-38b7f6e1a780',
|
||||
'fbf44fcd-7689-43a0-99c8-2c9faf6d825a',
|
||||
],
|
||||
receivedDateTime: '2023-09-04T09:18:35Z',
|
||||
sentDateTime: '2023-09-04T09:18:35Z',
|
||||
hasAttachments: false,
|
||||
internetMessageId:
|
||||
'<AM0PR10MB21003DD359041CBE7D64DDB6DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>',
|
||||
subject: 'New Draft',
|
||||
bodyPreview: 'draft message',
|
||||
importance: 'normal',
|
||||
parentFolderId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=',
|
||||
conversationId:
|
||||
'AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKELKTNBg5JJuTnBGaTDyl0=',
|
||||
conversationIndex: 'AQHZ3xDIoQspM0GDkkm5OcEZpMPKXQ==',
|
||||
isDeliveryReceiptRequested: false,
|
||||
isReadReceiptRequested: true,
|
||||
isRead: true,
|
||||
isDraft: true,
|
||||
webLink:
|
||||
'https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem',
|
||||
inferenceClassification: 'focused',
|
||||
body: {
|
||||
contentType: 'text',
|
||||
content: 'draft message',
|
||||
},
|
||||
toRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'some@mail.com',
|
||||
address: 'some@mail.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
ccRecipients: [],
|
||||
bccRecipients: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'name1@mail.com',
|
||||
address: 'name1@mail.com',
|
||||
},
|
||||
},
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'name2@mail.com',
|
||||
address: 'name2@mail.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
replyTo: [
|
||||
{
|
||||
emailAddress: {
|
||||
name: 'reply@mail.com',
|
||||
address: 'reply@mail.com',
|
||||
},
|
||||
},
|
||||
],
|
||||
flag: {
|
||||
flagStatus: 'notFlagged',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, draft => create', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/draft/create.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/messages',
|
||||
{
|
||||
bccRecipients: [
|
||||
{ emailAddress: { address: 'name1@mail.com' } },
|
||||
{ emailAddress: { address: 'name2@mail.com' } },
|
||||
],
|
||||
body: { content: 'draft message', contentType: 'Text' },
|
||||
categories: [
|
||||
'd10cd8f9-14ac-460e-a6ec-c40dd1876ea2',
|
||||
'6844a34e-4d23-4805-9fec-38b7f6e1a780',
|
||||
'fbf44fcd-7689-43a0-99c8-2c9faf6d825a',
|
||||
],
|
||||
importance: 'Normal',
|
||||
internetMessageHeaders: [{ name: 'x-my-header', value: 'header value' }],
|
||||
isReadReceiptRequested: true,
|
||||
replyTo: [{ emailAddress: { address: 'reply@mail.com' } }],
|
||||
subject: 'New Draft',
|
||||
toRecipients: [{ emailAddress: { address: 'some@mail.com' } }],
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "draft",
|
||||
"subject": "New Draft",
|
||||
"bodyContent": "draft message",
|
||||
"additionalFields": {
|
||||
"bccRecipients": "name1@mail.com, name2@mail.com",
|
||||
"categories": [
|
||||
"d10cd8f9-14ac-460e-a6ec-c40dd1876ea2",
|
||||
"6844a34e-4d23-4805-9fec-38b7f6e1a780",
|
||||
"fbf44fcd-7689-43a0-99c8-2c9faf6d825a"
|
||||
],
|
||||
"internetMessageHeaders": {
|
||||
"headers": [
|
||||
{
|
||||
"name": "x-my-header",
|
||||
"value": "header value"
|
||||
}
|
||||
]
|
||||
},
|
||||
"importance": "Normal",
|
||||
"bodyContentType": "Text",
|
||||
"isReadReceiptRequested": true,
|
||||
"replyTo": "reply@mail.com",
|
||||
"toRecipients": "some@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": {
|
||||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/messages/$entity",
|
||||
"@odata.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=",
|
||||
"createdDateTime": "2023-09-04T09:18:35Z",
|
||||
"lastModifiedDateTime": "2023-09-04T09:18:35Z",
|
||||
"changeKey": "CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3Bo2",
|
||||
"categories": [
|
||||
"d10cd8f9-14ac-460e-a6ec-c40dd1876ea2",
|
||||
"6844a34e-4d23-4805-9fec-38b7f6e1a780",
|
||||
"fbf44fcd-7689-43a0-99c8-2c9faf6d825a"
|
||||
],
|
||||
"receivedDateTime": "2023-09-04T09:18:35Z",
|
||||
"sentDateTime": "2023-09-04T09:18:35Z",
|
||||
"hasAttachments": false,
|
||||
"internetMessageId": "<AM0PR10MB21003DD359041CBE7D64DDB6DDE9A@AM0PR10MB2100.EURPRD10.PROD.OUTLOOK.COM>",
|
||||
"subject": "New Draft",
|
||||
"bodyPreview": "draft message",
|
||||
"importance": "normal",
|
||||
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAAA=",
|
||||
"conversationId": "AAQkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAQAKELKTNBg5JJuTnBGaTDyl0=",
|
||||
"conversationIndex": "AQHZ3xDIoQspM0GDkkm5OcEZpMPKXQ==",
|
||||
"isDeliveryReceiptRequested": false,
|
||||
"isReadReceiptRequested": true,
|
||||
"isRead": true,
|
||||
"isDraft": true,
|
||||
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
|
||||
"inferenceClassification": "focused",
|
||||
"body": {
|
||||
"contentType": "text",
|
||||
"content": "draft message"
|
||||
},
|
||||
"toRecipients": [
|
||||
{
|
||||
"emailAddress": {
|
||||
"name": "some@mail.com",
|
||||
"address": "some@mail.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ccRecipients": [],
|
||||
"bccRecipients": [
|
||||
{
|
||||
"emailAddress": {
|
||||
"name": "name1@mail.com",
|
||||
"address": "name1@mail.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"emailAddress": {
|
||||
"name": "name2@mail.com",
|
||||
"address": "name2@mail.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"replyTo": [
|
||||
{
|
||||
"emailAddress": {
|
||||
"name": "reply@mail.com",
|
||||
"address": "reply@mail.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"flag": {
|
||||
"flagStatus": "notFlagged"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "7c801e19-1108-4bae-85f1-902820df8c5e",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
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, draft => send', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/draft/send.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'PATCH',
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=',
|
||||
{ toRecipients: [{ emailAddress: { address: 'michael.k@radency.com' } }] },
|
||||
);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=/send',
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "draft",
|
||||
"operation": "send",
|
||||
"draftId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDupAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "New Draft",
|
||||
"cachedResultUrl": "https://outlook.office365.com/owa/?ItemID=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAEPAABZf4De%2FLkrSqpPI8eyjUmAAAFXBDupAAA%3D&exvsurl=1&viewmodel=ReadMessageItem"
|
||||
},
|
||||
"to": "michael.k@radency.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": "4bbe3403-3da7-4e6e-8341-7da5e8433330",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/calendars('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA%3D')/events/$entity",
|
||||
'@odata.etag': 'W/"WX+A3vy5K0qqTyPHso1JgAABVtwgEQ=="',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAENAABZf4De-LkrSqpPI8eyjUmAAAFXBFUSAAA=',
|
||||
createdDateTime: '2023-09-04T10:12:47.1985121Z',
|
||||
lastModifiedDateTime: '2023-09-04T10:12:48.2173253Z',
|
||||
changeKey: 'WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==',
|
||||
categories: ['Yellow category', 'Orange category'],
|
||||
transactionId: null,
|
||||
originalStartTimeZone: 'UTC',
|
||||
originalEndTimeZone: 'UTC',
|
||||
iCalUId:
|
||||
'040000008200E00074C5B7101A82E0080000000062DD545A18DFD90100000000000000001000000004C50947C7B42140B29018ABAB42C965',
|
||||
reminderMinutesBeforeStart: 15,
|
||||
isReminderOn: true,
|
||||
hasAttachments: false,
|
||||
subject: 'New Event',
|
||||
bodyPreview:
|
||||
'event description\r\n________________________________________________________________________________\r\nMicrosoft Teams meeting\r\nJoin on your computer, mobile app or room device\r\nClick here to join the meeting\r\nMeeting ID: 355 132 640 047\r\nPasscode: xgUo7v',
|
||||
importance: 'normal',
|
||||
sensitivity: 'personal',
|
||||
isAllDay: false,
|
||||
isCancelled: false,
|
||||
isOrganizer: true,
|
||||
responseRequested: true,
|
||||
seriesMasterId: null,
|
||||
showAs: 'busy',
|
||||
type: 'singleInstance',
|
||||
webLink:
|
||||
'https://outlook.office365.com/owa/?itemid=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAENAABZf4De%2FLkrSqpPI8eyjUmAAAFXBFUSAAA%3D&exvsurl=1&path=/calendar/item',
|
||||
onlineMeetingUrl: null,
|
||||
isOnlineMeeting: true,
|
||||
onlineMeetingProvider: 'teamsForBusiness',
|
||||
allowNewTimeProposals: true,
|
||||
occurrenceId: null,
|
||||
isDraft: false,
|
||||
hideAttendees: true,
|
||||
responseStatus: {
|
||||
response: 'organizer',
|
||||
time: '0001-01-01T00:00:00Z',
|
||||
},
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'<html>\r\n<head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n</head>\r\n<body>\r\nevent description<br>\r\n<div style="width:100%"><span style="white-space:nowrap; color:#5F5F5F; opacity:.36">________________________________________________________________________________</span>\r\n</div>\r\n<div class="me-email-text" lang="en-US" style="color:#252424; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\n<div style="margin-top:24px; margin-bottom:20px"><span style="font-size:24px; color:#252424">Microsoft Teams meeting</span>\r\n</div>\r\n<div style="margin-bottom:20px">\r\n<div style="margin-top:0px; margin-bottom:0px; font-weight:bold"><span style="font-size:14px; color:#252424">Join on your computer, mobile app or room device</span>\r\n</div>\r\n<a href="https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d" class="me-email-headline" style="font-size:14px; font-family:\'Segoe UI Semibold\',\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif; text-decoration:underline; color:#6264a7">Click\r\n here to join the meeting</a> </div>\r\n<div style="margin-bottom:20px; margin-top:20px">\r\n<div style="margin-bottom:4px"><span data-tid="meeting-code" style="font-size:14px; color:#252424">Meeting ID:\r\n<span style="font-size:16px; color:#252424">355 132 640 047</span> </span><br>\r\n<span style="font-size:14px; color:#252424">Passcode: </span><span style="font-size:16px; color:#252424">xgUo7v\r\n</span>\r\n<div style="font-size:14px"><a href="https://www.microsoft.com/en-us/microsoft-teams/download-app" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">Download\r\n Teams</a> | <a href="https://www.microsoft.com/microsoft-teams/join-a-meeting" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\nJoin on the web</a></div>\r\n</div>\r\n</div>\r\n<div style="margin-bottom:24px; margin-top:20px"><a href="https://aka.ms/JoinTeamsMeeting" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">Learn More</a>\r\n | <a href="https://teams.microsoft.com/meetingOptions/?organizerId=b834447b-6848-4af9-8390-d2259ce46b74&tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337&threadId=19_meeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3@thread.v2&messageId=0&language=en-US" class="me-email-link" style="font-size:14px; text-decoration:underline; color:#6264a7; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\nMeeting options</a> </div>\r\n</div>\r\n<div style="font-size:14px; margin-bottom:4px; font-family:\'Segoe UI\',\'Helvetica Neue\',Helvetica,Arial,sans-serif">\r\n</div>\r\n<div style="font-size:12px"></div>\r\n<div></div>\r\n<div style="width:100%"><span style="white-space:nowrap; color:#5F5F5F; opacity:.36">________________________________________________________________________________</span>\r\n</div>\r\n</body>\r\n</html>\r\n',
|
||||
},
|
||||
start: {
|
||||
dateTime: '2023-09-05T07:26:47.0000000',
|
||||
timeZone: 'UTC',
|
||||
},
|
||||
end: {
|
||||
dateTime: '2023-09-06T07:56:47.0000000',
|
||||
timeZone: 'UTC',
|
||||
},
|
||||
location: {
|
||||
displayName: 'Microsoft Teams Meeting',
|
||||
locationType: 'default',
|
||||
uniqueId: 'Microsoft Teams Meeting',
|
||||
uniqueIdType: 'private',
|
||||
},
|
||||
locations: [
|
||||
{
|
||||
displayName: 'Microsoft Teams Meeting',
|
||||
locationType: 'default',
|
||||
uniqueId: 'Microsoft Teams Meeting',
|
||||
uniqueIdType: 'private',
|
||||
},
|
||||
],
|
||||
recurrence: null,
|
||||
attendees: [],
|
||||
organizer: {
|
||||
emailAddress: {
|
||||
name: 'Michael Kret',
|
||||
address: 'MichaelDevSandbox@5w1hb7.onmicrosoft.com',
|
||||
},
|
||||
},
|
||||
onlineMeeting: {
|
||||
joinUrl:
|
||||
'https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, contact => event', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/event/create.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/calendars/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=/events',
|
||||
{
|
||||
body: { content: 'event description', contentType: 'html' },
|
||||
bodyPreview: 'preview',
|
||||
categories: ['Yellow category', 'Orange category'],
|
||||
end: { dateTime: '2023-09-06T07:56:47.000Z', timeZone: 'UTC' },
|
||||
hideAttendees: true,
|
||||
importance: 'normal',
|
||||
isAllDay: false,
|
||||
isCancelled: false,
|
||||
isDraft: false,
|
||||
isOnlineMeeting: true,
|
||||
sensitivity: 'personal',
|
||||
showAs: 'busy',
|
||||
start: { dateTime: '2023-09-05T07:26:47.000Z', timeZone: 'UTC' },
|
||||
subject: 'New Event',
|
||||
type: 'occurrence',
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,170 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "event",
|
||||
"operation": "create",
|
||||
"calendarId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Calendar"
|
||||
},
|
||||
"subject": "New Event",
|
||||
"startDateTime": "2023-09-05T07:26:47.000Z",
|
||||
"endDateTime": "2023-09-06T07:56:47.000Z",
|
||||
"additionalFields": {
|
||||
"categories": [
|
||||
"Yellow category",
|
||||
"Orange category"
|
||||
],
|
||||
"body": "event description",
|
||||
"bodyPreview": "preview",
|
||||
"hideAttendees": true,
|
||||
"importance": "normal",
|
||||
"isAllDay": false,
|
||||
"isCancelled": false,
|
||||
"isDraft": false,
|
||||
"isOnlineMeeting": true,
|
||||
"sensitivity": "personal",
|
||||
"showAs": "busy",
|
||||
"type": "occurrence"
|
||||
}
|
||||
},
|
||||
"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')/calendars('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEGAABZf4De-LkrSqpPI8eyjUmAAAAJ9-JDAAA%3D')/events/$entity",
|
||||
"@odata.etag": "W/\"WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAENAABZf4De-LkrSqpPI8eyjUmAAAFXBFUSAAA=",
|
||||
"createdDateTime": "2023-09-04T10:12:47.1985121Z",
|
||||
"lastModifiedDateTime": "2023-09-04T10:12:48.2173253Z",
|
||||
"changeKey": "WX+A3vy5K0qqTyPHso1JgAABVtwgEQ==",
|
||||
"categories": [
|
||||
"Yellow category",
|
||||
"Orange category"
|
||||
],
|
||||
"transactionId": null,
|
||||
"originalStartTimeZone": "UTC",
|
||||
"originalEndTimeZone": "UTC",
|
||||
"iCalUId": "040000008200E00074C5B7101A82E0080000000062DD545A18DFD90100000000000000001000000004C50947C7B42140B29018ABAB42C965",
|
||||
"reminderMinutesBeforeStart": 15,
|
||||
"isReminderOn": true,
|
||||
"hasAttachments": false,
|
||||
"subject": "New Event",
|
||||
"bodyPreview": "event description\r\n________________________________________________________________________________\r\nMicrosoft Teams meeting\r\nJoin on your computer, mobile app or room device\r\nClick here to join the meeting\r\nMeeting ID: 355 132 640 047\r\nPasscode: xgUo7v",
|
||||
"importance": "normal",
|
||||
"sensitivity": "personal",
|
||||
"isAllDay": false,
|
||||
"isCancelled": false,
|
||||
"isOrganizer": true,
|
||||
"responseRequested": true,
|
||||
"seriesMasterId": null,
|
||||
"showAs": "busy",
|
||||
"type": "singleInstance",
|
||||
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De%2FLkrSqpPI8eyjUmAAAAAAAENAABZf4De%2FLkrSqpPI8eyjUmAAAFXBFUSAAA%3D&exvsurl=1&path=/calendar/item",
|
||||
"onlineMeetingUrl": null,
|
||||
"isOnlineMeeting": true,
|
||||
"onlineMeetingProvider": "teamsForBusiness",
|
||||
"allowNewTimeProposals": true,
|
||||
"occurrenceId": null,
|
||||
"isDraft": false,
|
||||
"hideAttendees": true,
|
||||
"responseStatus": {
|
||||
"response": "organizer",
|
||||
"time": "0001-01-01T00:00:00Z"
|
||||
},
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n</head>\r\n<body>\r\nevent description<br>\r\n<div style=\"width:100%\"><span style=\"white-space:nowrap; color:#5F5F5F; opacity:.36\">________________________________________________________________________________</span>\r\n</div>\r\n<div class=\"me-email-text\" lang=\"en-US\" style=\"color:#252424; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\n<div style=\"margin-top:24px; margin-bottom:20px\"><span style=\"font-size:24px; color:#252424\">Microsoft Teams meeting</span>\r\n</div>\r\n<div style=\"margin-bottom:20px\">\r\n<div style=\"margin-top:0px; margin-bottom:0px; font-weight:bold\"><span style=\"font-size:14px; color:#252424\">Join on your computer, mobile app or room device</span>\r\n</div>\r\n<a href=\"https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d\" class=\"me-email-headline\" style=\"font-size:14px; font-family:'Segoe UI Semibold','Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; text-decoration:underline; color:#6264a7\">Click\r\n here to join the meeting</a> </div>\r\n<div style=\"margin-bottom:20px; margin-top:20px\">\r\n<div style=\"margin-bottom:4px\"><span data-tid=\"meeting-code\" style=\"font-size:14px; color:#252424\">Meeting ID:\r\n<span style=\"font-size:16px; color:#252424\">355 132 640 047</span> </span><br>\r\n<span style=\"font-size:14px; color:#252424\">Passcode: </span><span style=\"font-size:16px; color:#252424\">xgUo7v\r\n</span>\r\n<div style=\"font-size:14px\"><a href=\"https://www.microsoft.com/en-us/microsoft-teams/download-app\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">Download\r\n Teams</a> | <a href=\"https://www.microsoft.com/microsoft-teams/join-a-meeting\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\nJoin on the web</a></div>\r\n</div>\r\n</div>\r\n<div style=\"margin-bottom:24px; margin-top:20px\"><a href=\"https://aka.ms/JoinTeamsMeeting\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">Learn More</a>\r\n | <a href=\"https://teams.microsoft.com/meetingOptions/?organizerId=b834447b-6848-4af9-8390-d2259ce46b74&tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337&threadId=19_meeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3@thread.v2&messageId=0&language=en-US\" class=\"me-email-link\" style=\"font-size:14px; text-decoration:underline; color:#6264a7; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\nMeeting options</a> </div>\r\n</div>\r\n<div style=\"font-size:14px; margin-bottom:4px; font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif\">\r\n</div>\r\n<div style=\"font-size:12px\"></div>\r\n<div></div>\r\n<div style=\"width:100%\"><span style=\"white-space:nowrap; color:#5F5F5F; opacity:.36\">________________________________________________________________________________</span>\r\n</div>\r\n</body>\r\n</html>\r\n"
|
||||
},
|
||||
"start": {
|
||||
"dateTime": "2023-09-05T07:26:47.0000000",
|
||||
"timeZone": "UTC"
|
||||
},
|
||||
"end": {
|
||||
"dateTime": "2023-09-06T07:56:47.0000000",
|
||||
"timeZone": "UTC"
|
||||
},
|
||||
"location": {
|
||||
"displayName": "Microsoft Teams Meeting",
|
||||
"locationType": "default",
|
||||
"uniqueId": "Microsoft Teams Meeting",
|
||||
"uniqueIdType": "private"
|
||||
},
|
||||
"locations": [
|
||||
{
|
||||
"displayName": "Microsoft Teams Meeting",
|
||||
"locationType": "default",
|
||||
"uniqueId": "Microsoft Teams Meeting",
|
||||
"uniqueIdType": "private"
|
||||
}
|
||||
],
|
||||
"recurrence": null,
|
||||
"attendees": [],
|
||||
"organizer": {
|
||||
"emailAddress": {
|
||||
"name": "Michael Kret",
|
||||
"address": "MichaelDevSandbox@5w1hb7.onmicrosoft.com"
|
||||
}
|
||||
},
|
||||
"onlineMeeting": {
|
||||
"joinUrl": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_MDZmMzZmYzYtMDc4Yi00NTA2LWE3MTMtZDc5ZDI1M2JmY2M3%40thread.v2/0?context=%7b%22Tid%22%3a%2223786ca6-7ff2-4672-87d0-5c649ee0a337%22%2c%22Oid%22%3a%22b834447b-6848-4af9-8390-d2259ce46b74%22%7d"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "dceb08aa-5897-44d1-afbc-748d1e8a2626",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/mailFolders('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA%3D')/childFolders/$entity",
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=',
|
||||
displayName: 'Folder 42',
|
||||
parentFolderId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=',
|
||||
childFolderCount: 0,
|
||||
unreadItemCount: 0,
|
||||
totalItemCount: 0,
|
||||
sizeInBytes: 0,
|
||||
isHidden: false,
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, contact => folder', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/folder/create.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/mailFolders/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=/childFolders',
|
||||
{ displayName: 'Folder 42' },
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "folder",
|
||||
"displayName": "Folder 42",
|
||||
"options": {
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "New folder",
|
||||
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEGAAA%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": {
|
||||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('b834447b-6848-4af9-8390-d2259ce46b74')/mailFolders('AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA%3D')/childFolders/$entity",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
|
||||
"displayName": "Folder 42",
|
||||
"parentFolderId": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEGAAA=",
|
||||
"childFolderCount": 0,
|
||||
"unreadItemCount": 0,
|
||||
"totalItemCount": 0,
|
||||
"sizeInBytes": 0,
|
||||
"isHidden": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "6f7a33a8-d48a-4ae2-ab1c-bbe0a83d376f",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequestAllItems: jest.fn(async function (method: string) {
|
||||
return [
|
||||
{
|
||||
'@odata.etag': 'W/"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CAj"',
|
||||
id: 'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAABZf4De-LkrSqpPI8eyjUmAAAFXBGDUAAA=',
|
||||
subject: 'XXXX',
|
||||
bodyPreview: 'test',
|
||||
},
|
||||
];
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, folderMessage => getAll', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/folderMessage/getAll.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequestAllItems).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequestAllItems).toHaveBeenCalledWith(
|
||||
'value',
|
||||
'GET',
|
||||
'/mailFolders/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=/messages',
|
||||
undefined,
|
||||
{ $select: 'bodyPreview,subject' },
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"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": {
|
||||
"resource": "folderMessage",
|
||||
"folderId": {
|
||||
"__rl": true,
|
||||
"value": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Folder 42",
|
||||
"cachedResultUrl": "https://outlook.office365.com/mail/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De%2FLkrSqpPI8eyjUmAAAFXBAEHAAA%3D"
|
||||
},
|
||||
"returnAll": true,
|
||||
"output": "fields",
|
||||
"fields": [
|
||||
"bodyPreview",
|
||||
"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.etag": "W/\"CQAAABYAAABZf4De/LkrSqpPI8eyjUmAAAFW3CAj\"",
|
||||
"id": "AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAABZf4De-LkrSqpPI8eyjUmAAAFXBGDUAAA=",
|
||||
"subject": "XXXX",
|
||||
"bodyPreview": "test"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Outlook",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "63e4c95c-2998-4f3a-bcbc-1dfea015fecb",
|
||||
"id": "1CYHzBXQw1nfPGtB",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
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 => move', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/message/move.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/move',
|
||||
{
|
||||
destinationId:
|
||||
'AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OAAuAAAAAABPLqzvT6b9RLP0CKzHiJrRAQBZf4De-LkrSqpPI8eyjUmAAAFXBAEHAAA=',
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -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,128 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(async function (method: string) {
|
||||
if (method === 'POST') {
|
||||
return {
|
||||
'@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',
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftOutlookV2, message => reply', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/message/reply.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEJAABZf4De-LkrSqpPI8eyjUmAAAFXBEVwAAA=/createReply',
|
||||
{
|
||||
message: {
|
||||
body: { content: 'Reply message', contentType: 'html' },
|
||||
importance: 'High',
|
||||
subject: 'Reply Subject',
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/messages/AAMkADlhOTA0MTc5LWUwOTMtNDRkZS05NzE0LTNlYmI0ZWM5OWI5OABGAAAAAABPLqzvT6b9RLP0CKzHiJrRBwBZf4De-LkrSqpPI8eyjUmAAAAAAAEPAABZf4De-LkrSqpPI8eyjUmAAAFXBDurAAA=/send',
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -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,67 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
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 => send', () => {
|
||||
const workflows = ['nodes/Microsoft/Outlook/test/v2/node/message/send.workflow.json'];
|
||||
const tests = workflowToTests(workflows);
|
||||
|
||||
beforeAll(() => {
|
||||
nock.disableNetConnect();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
nock.restore();
|
||||
jest.unmock('../../../../v2/transport');
|
||||
});
|
||||
|
||||
const nodeTypes = setup(tests);
|
||||
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/sendMail',
|
||||
{
|
||||
message: {
|
||||
body: { content: 'message description', contentType: 'Text' },
|
||||
replyTo: [{ emailAddress: { address: 'reply@mail.com' } }],
|
||||
subject: 'Hello',
|
||||
toRecipients: [{ emailAddress: { address: 'to@mail.com' } }],
|
||||
},
|
||||
saveToSentItems: true,
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
};
|
||||
|
||||
for (const testData of tests) {
|
||||
test(testData.description, async () => testNode(testData, nodeTypes));
|
||||
}
|
||||
});
|
||||
@@ -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": []
|
||||
}
|
||||
Reference in New Issue
Block a user