first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../../../credentials';
|
||||
|
||||
describe('Test MicrosoftTeamsV2, chatMessage => create', () => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.post('/v1.0/chats/19:ebed9ad42c904d6c83adf0db360053ec@thread.v2/messages')
|
||||
.reply(200, {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#chats('19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2')/messages/$entity",
|
||||
id: '1698378560692',
|
||||
replyToId: null,
|
||||
etag: '1698378560692',
|
||||
messageType: 'message',
|
||||
createdDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastModifiedDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastEditedDateTime: null,
|
||||
deletedDateTime: null,
|
||||
subject: null,
|
||||
summary: null,
|
||||
chatId: '19:ebed9ad42c904d6c83adf0db360053ec@thread.v2',
|
||||
importance: 'normal',
|
||||
locale: 'en-us',
|
||||
webUrl: null,
|
||||
channelIdentity: null,
|
||||
policyViolation: null,
|
||||
eventDetail: null,
|
||||
from: {
|
||||
application: null,
|
||||
device: null,
|
||||
user: {
|
||||
'@odata.type': '#microsoft.graph.teamworkUserIdentity',
|
||||
id: '11111-2222-3333',
|
||||
displayName: 'Michael Kret',
|
||||
userIdentityType: 'aadUser',
|
||||
},
|
||||
},
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'Hello!<br>\n<br>\n<em> Powered by <a href="http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363">this n8n workflow</a> </em>',
|
||||
},
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
reactions: [],
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['create.workflow.json'],
|
||||
});
|
||||
});
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"name": "My workflow 35",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "6666-9999-77777",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
880,
|
||||
380
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "chatMessage",
|
||||
"chatId": {
|
||||
"__rl": true,
|
||||
"value": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Grady Archie, Adele Vance, Henrietta Mueller, Patti Fernandez, Diego Siciliani, Michael Kret (group)",
|
||||
"cachedResultUrl": "https://teams.microsoft.com/l/chat/19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2/0?tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
},
|
||||
"message": "Hello!",
|
||||
"options": {
|
||||
"includeLinkToWorkflow": true
|
||||
}
|
||||
},
|
||||
"id": "6666-5555-77777",
|
||||
"name": "Microsoft Teams",
|
||||
"type": "n8n-nodes-base.microsoftTeams",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1100,
|
||||
380
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftTeamsOAuth2Api": {
|
||||
"id": "6isd5ytvA0qV78eK",
|
||||
"name": "Microsoft Teams account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "9d1a2e59-c71c-486c-b3ac-dec6adbc26b3",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1400,
|
||||
380
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats('19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2')/messages/$entity",
|
||||
"id": "1698378560692",
|
||||
"replyToId": null,
|
||||
"etag": "1698378560692",
|
||||
"messageType": "message",
|
||||
"createdDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastModifiedDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastEditedDateTime": null,
|
||||
"deletedDateTime": null,
|
||||
"subject": null,
|
||||
"summary": null,
|
||||
"chatId": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"importance": "normal",
|
||||
"locale": "en-us",
|
||||
"webUrl": null,
|
||||
"channelIdentity": null,
|
||||
"policyViolation": null,
|
||||
"eventDetail": null,
|
||||
"from": {
|
||||
"application": null,
|
||||
"device": null,
|
||||
"user": {
|
||||
"@odata.type": "#microsoft.graph.teamworkUserIdentity",
|
||||
"id": "11111-2222-3333",
|
||||
"displayName": "Michael Kret",
|
||||
"userIdentityType": "aadUser"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "Hello!<br>\n<br>\n<em> Powered by <a href=\"http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363\">this n8n workflow</a> </em>"
|
||||
},
|
||||
"attachments": [],
|
||||
"mentions": [],
|
||||
"reactions": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Teams",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Teams": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "4b3813fc-dee5-4560-becc-9e2c7fe881d6",
|
||||
"id": "i3NYGF0LXV4qDFV9",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../../../credentials';
|
||||
|
||||
describe('Test MicrosoftTeamsV2, chatMessage => get', () => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.get('/v1.0/chats/19:ebed9ad42c904d6c83adf0db360053ec@thread.v2/messages/1698378560692')
|
||||
.reply(200, {
|
||||
'@odata.context':
|
||||
"https://graph.microsoft.com/v1.0/$metadata#chats('19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2')/messages/$entity",
|
||||
id: '1698378560692',
|
||||
replyToId: null,
|
||||
etag: '1698378560692',
|
||||
messageType: 'message',
|
||||
createdDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastModifiedDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastEditedDateTime: null,
|
||||
deletedDateTime: null,
|
||||
subject: null,
|
||||
summary: null,
|
||||
chatId: '19:ebed9ad42c904d6c83adf0db360053ec@thread.v2',
|
||||
importance: 'normal',
|
||||
locale: 'en-us',
|
||||
webUrl: null,
|
||||
channelIdentity: null,
|
||||
policyViolation: null,
|
||||
eventDetail: null,
|
||||
from: {
|
||||
application: null,
|
||||
device: null,
|
||||
user: {
|
||||
'@odata.type': '#microsoft.graph.teamworkUserIdentity',
|
||||
id: '11111-2222-3333',
|
||||
displayName: 'Michael Kret',
|
||||
userIdentityType: 'aadUser',
|
||||
tenantId: '23786ca6-7ff2-4672-87d0-5c649ee0a337',
|
||||
},
|
||||
},
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'Hello!<br>\n<br>\n<em> Powered by <a href="http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363">this n8n workflow</a> </em>',
|
||||
},
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
reactions: [],
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['get.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"name": "My workflow 35",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "6666-9999-77777",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
880,
|
||||
380
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "chatMessage",
|
||||
"operation": "get",
|
||||
"chatId": {
|
||||
"__rl": true,
|
||||
"value": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Grady Archie, Adele Vance, Henrietta Mueller, Patti Fernandez, Diego Siciliani, Michael Kret (group)",
|
||||
"cachedResultUrl": "https://teams.microsoft.com/l/chat/19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2/0?tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
},
|
||||
"messageId": "1698378560692"
|
||||
},
|
||||
"id": "6666-5555-77777",
|
||||
"name": "Microsoft Teams",
|
||||
"type": "n8n-nodes-base.microsoftTeams",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1100,
|
||||
380
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftTeamsOAuth2Api": {
|
||||
"id": "6isd5ytvA0qV78eK",
|
||||
"name": "Microsoft Teams account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "9d1a2e59-c71c-486c-b3ac-dec6adbc26b3",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1400,
|
||||
380
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#chats('19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2')/messages/$entity",
|
||||
"id": "1698378560692",
|
||||
"replyToId": null,
|
||||
"etag": "1698378560692",
|
||||
"messageType": "message",
|
||||
"createdDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastModifiedDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastEditedDateTime": null,
|
||||
"deletedDateTime": null,
|
||||
"subject": null,
|
||||
"summary": null,
|
||||
"chatId": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"importance": "normal",
|
||||
"locale": "en-us",
|
||||
"webUrl": null,
|
||||
"channelIdentity": null,
|
||||
"policyViolation": null,
|
||||
"eventDetail": null,
|
||||
"from": {
|
||||
"application": null,
|
||||
"device": null,
|
||||
"user": {
|
||||
"@odata.type": "#microsoft.graph.teamworkUserIdentity",
|
||||
"id": "11111-2222-3333",
|
||||
"displayName": "Michael Kret",
|
||||
"userIdentityType": "aadUser",
|
||||
"tenantId": "23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "Hello!<br>\n<br>\n<em> Powered by <a href=\"http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363\">this n8n workflow</a> </em>"
|
||||
},
|
||||
"attachments": [],
|
||||
"mentions": [],
|
||||
"reactions": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Teams",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Teams": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "4de0815e-b1b7-463a-a627-c55ac71b70e4",
|
||||
"id": "i3NYGF0LXV4qDFV9",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../../../credentials';
|
||||
|
||||
describe('Test MicrosoftTeamsV2, chatMessage => getAll', () => {
|
||||
nock('https://graph.microsoft.com')
|
||||
.get('/v1.0/chats/19:ebed9ad42c904d6c83adf0db360053ec@thread.v2/messages')
|
||||
.reply(200, {
|
||||
value: [
|
||||
{
|
||||
id: '1698378560692',
|
||||
replyToId: null,
|
||||
etag: '1698378560692',
|
||||
messageType: 'message',
|
||||
createdDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastModifiedDateTime: '2023-10-27T03:49:20.692Z',
|
||||
lastEditedDateTime: null,
|
||||
deletedDateTime: null,
|
||||
subject: null,
|
||||
summary: null,
|
||||
chatId: '19:ebed9ad42c904d6c83adf0db360053ec@thread.v2',
|
||||
importance: 'normal',
|
||||
locale: 'en-us',
|
||||
webUrl: null,
|
||||
channelIdentity: null,
|
||||
policyViolation: null,
|
||||
eventDetail: null,
|
||||
from: {
|
||||
application: null,
|
||||
device: null,
|
||||
user: {
|
||||
'@odata.type': '#microsoft.graph.teamworkUserIdentity',
|
||||
id: '11111-2222-3333',
|
||||
displayName: 'Michael Kret',
|
||||
userIdentityType: 'aadUser',
|
||||
tenantId: '23786ca6-7ff2-4672-87d0-5c649ee0a337',
|
||||
},
|
||||
},
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'Hello!<br>\n<br>\n<em> Powered by <a href="http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363">this n8n workflow</a> </em>',
|
||||
},
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
reactions: [],
|
||||
},
|
||||
{
|
||||
id: '1698129297101',
|
||||
replyToId: null,
|
||||
etag: '1698129297101',
|
||||
messageType: 'message',
|
||||
createdDateTime: '2023-10-24T06:34:57.101Z',
|
||||
lastModifiedDateTime: '2023-10-24T06:34:57.101Z',
|
||||
lastEditedDateTime: null,
|
||||
deletedDateTime: null,
|
||||
subject: null,
|
||||
summary: null,
|
||||
chatId: '19:ebed9ad42c904d6c83adf0db360053ec@thread.v2',
|
||||
importance: 'normal',
|
||||
locale: 'en-us',
|
||||
webUrl: null,
|
||||
channelIdentity: null,
|
||||
policyViolation: null,
|
||||
eventDetail: null,
|
||||
from: {
|
||||
application: null,
|
||||
device: null,
|
||||
user: {
|
||||
'@odata.type': '#microsoft.graph.teamworkUserIdentity',
|
||||
id: '11111-2222-3333',
|
||||
displayName: 'Michael Kret',
|
||||
userIdentityType: 'aadUser',
|
||||
tenantId: '23786ca6-7ff2-4672-87d0-5c649ee0a337',
|
||||
},
|
||||
},
|
||||
body: {
|
||||
contentType: 'html',
|
||||
content:
|
||||
'tada<br>\n<br>\n<em> Powered by <a href="http://localhost:5678/workflow/5sTm8tp3j3niFewr?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363">this n8n workflow</a> </em>',
|
||||
},
|
||||
attachments: [],
|
||||
mentions: [],
|
||||
reactions: [],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
});
|
||||
});
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
{
|
||||
"name": "My workflow 35",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "6666-9999-77777",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
880,
|
||||
380
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "chatMessage",
|
||||
"operation": "getAll",
|
||||
"chatId": {
|
||||
"__rl": true,
|
||||
"value": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"mode": "list",
|
||||
"cachedResultName": "Grady Archie, Adele Vance, Henrietta Mueller, Patti Fernandez, Diego Siciliani, Michael Kret (group)",
|
||||
"cachedResultUrl": "https://teams.microsoft.com/l/chat/19%3Aebed9ad42c904d6c83adf0db360053ec%40thread.v2/0?tenantId=23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
},
|
||||
"limit": 2
|
||||
},
|
||||
"id": "6666-5555-77777",
|
||||
"name": "Microsoft Teams",
|
||||
"type": "n8n-nodes-base.microsoftTeams",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1100,
|
||||
380
|
||||
],
|
||||
"credentials": {
|
||||
"microsoftTeamsOAuth2Api": {
|
||||
"id": "6isd5ytvA0qV78eK",
|
||||
"name": "Microsoft Teams account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "9d1a2e59-c71c-486c-b3ac-dec6adbc26b3",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1400,
|
||||
380
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"id": "1698378560692",
|
||||
"replyToId": null,
|
||||
"etag": "1698378560692",
|
||||
"messageType": "message",
|
||||
"createdDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastModifiedDateTime": "2023-10-27T03:49:20.692Z",
|
||||
"lastEditedDateTime": null,
|
||||
"deletedDateTime": null,
|
||||
"subject": null,
|
||||
"summary": null,
|
||||
"chatId": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"importance": "normal",
|
||||
"locale": "en-us",
|
||||
"webUrl": null,
|
||||
"channelIdentity": null,
|
||||
"policyViolation": null,
|
||||
"eventDetail": null,
|
||||
"from": {
|
||||
"application": null,
|
||||
"device": null,
|
||||
"user": {
|
||||
"@odata.type": "#microsoft.graph.teamworkUserIdentity",
|
||||
"id": "11111-2222-3333",
|
||||
"displayName": "Michael Kret",
|
||||
"userIdentityType": "aadUser",
|
||||
"tenantId": "23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "Hello!<br>\n<br>\n<em> Powered by <a href=\"http://localhost:5678/workflow/i3NYGF0LXV4qDFV9?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363\">this n8n workflow</a> </em>"
|
||||
},
|
||||
"attachments": [],
|
||||
"mentions": [],
|
||||
"reactions": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "1698129297101",
|
||||
"replyToId": null,
|
||||
"etag": "1698129297101",
|
||||
"messageType": "message",
|
||||
"createdDateTime": "2023-10-24T06:34:57.101Z",
|
||||
"lastModifiedDateTime": "2023-10-24T06:34:57.101Z",
|
||||
"lastEditedDateTime": null,
|
||||
"deletedDateTime": null,
|
||||
"subject": null,
|
||||
"summary": null,
|
||||
"chatId": "19:ebed9ad42c904d6c83adf0db360053ec@thread.v2",
|
||||
"importance": "normal",
|
||||
"locale": "en-us",
|
||||
"webUrl": null,
|
||||
"channelIdentity": null,
|
||||
"policyViolation": null,
|
||||
"eventDetail": null,
|
||||
"from": {
|
||||
"application": null,
|
||||
"device": null,
|
||||
"user": {
|
||||
"@odata.type": "#microsoft.graph.teamworkUserIdentity",
|
||||
"id": "11111-2222-3333",
|
||||
"displayName": "Michael Kret",
|
||||
"userIdentityType": "aadUser",
|
||||
"tenantId": "23786ca6-7ff2-4672-87d0-5c649ee0a337"
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"contentType": "html",
|
||||
"content": "tada<br>\n<br>\n<em> Powered by <a href=\"http://localhost:5678/workflow/5sTm8tp3j3niFewr?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363\">this n8n workflow</a> </em>"
|
||||
},
|
||||
"attachments": [],
|
||||
"mentions": [],
|
||||
"reactions": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Microsoft Teams",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Microsoft Teams": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "324b8a88-47a1-453e-906f-79f9be836e17",
|
||||
"id": "i3NYGF0LXV4qDFV9",
|
||||
"meta": {
|
||||
"instanceId": "b888bd11cd1ddbb95450babf3e199556799d999b896f650de768b8370ee50363"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
import type { MockProxy } from 'jest-mock-extended';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { SEND_AND_WAIT_OPERATION, type IExecuteFunctions, type INode } from 'n8n-workflow';
|
||||
|
||||
import { versionDescription } from '../../../../v2/actions/versionDescription';
|
||||
import { MicrosoftTeamsV2 } from '../../../../v2/MicrosoftTeamsV2.node';
|
||||
import * as transport from '../../../../v2/transport';
|
||||
|
||||
jest.mock('../../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
microsoftApiRequest: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Test MicrosoftTeamsV2, chatMessage => sendAndWait', () => {
|
||||
let microsoftTeamsV2: MicrosoftTeamsV2;
|
||||
let mockExecuteFunctions: MockProxy<IExecuteFunctions>;
|
||||
|
||||
beforeEach(() => {
|
||||
microsoftTeamsV2 = new MicrosoftTeamsV2(versionDescription);
|
||||
mockExecuteFunctions = mock<IExecuteFunctions>();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should send message and put execution to wait', async () => {
|
||||
const items = [{ json: { data: 'test' } }];
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((key: string) => {
|
||||
if (key === 'operation') return SEND_AND_WAIT_OPERATION;
|
||||
if (key === 'resource') return 'chatMessage';
|
||||
if (key === 'chatId') return 'chatID';
|
||||
if (key === 'message') return 'my message';
|
||||
if (key === 'subject') return '';
|
||||
if (key === 'approvalOptions.values') return {};
|
||||
if (key === 'responseType') return 'approval';
|
||||
if (key === 'options.limitWaitTime.values') return {};
|
||||
});
|
||||
|
||||
mockExecuteFunctions.putExecutionToWait.mockImplementation();
|
||||
mockExecuteFunctions.getInputData.mockReturnValue(items);
|
||||
mockExecuteFunctions.getInstanceId.mockReturnValue('instanceId');
|
||||
mockExecuteFunctions.getNode.mockReturnValue(mock<INode>({ typeVersion: 2 }));
|
||||
|
||||
mockExecuteFunctions.getSignedResumeUrl.mockReturnValue(
|
||||
'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
|
||||
);
|
||||
|
||||
const result = await microsoftTeamsV2.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result).toEqual([items]);
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(mockExecuteFunctions.putExecutionToWait).toHaveBeenCalledTimes(1);
|
||||
|
||||
expect(transport.microsoftApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/v1.0/chats/chatID/messages',
|
||||
{
|
||||
body: {
|
||||
content:
|
||||
'my message<br><br><a href="http://localhost/waiting-webhook/nodeID?approved=true&signature=abc">Approve</a><br><br><em>This message was sent automatically with <a href="https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.microsoftTeams_instanceId">n8n</a></em>',
|
||||
contentType: 'html',
|
||||
},
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user