Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ export class SlackV2 implements INodeType {
if (operation === 'create') {
const name = this.getNodeParameter('name', i) as string;

const options = this.getNodeParameter('options', i);
const options = this.getNodeParameter('Options', i);

const body: IDataObject = {
name,
Expand All @@ -1340,7 +1340,7 @@ export class SlackV2 implements INodeType {
if (operation === 'enable') {
const userGroupId = this.getNodeParameter('userGroupId', i) as string;

const options = this.getNodeParameter('options', i);
const options = this.getNodeParameter('option', i);

const body: IDataObject = {
usergroup: userGroupId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';

const API_RESPONSE = {
ok: true,
usergroup: {
id: 'S0615G0KT',
team_id: 'T060RNRCH',
is_usergroup: true,
name: 'Marketing Team',
description: 'Marketing gurus, PR experts and product advocates.',
handle: 'marketing-team',
is_external: false,
date_create: 1446746793,
date_update: 1446746793,
date_delete: 0,
auto_type: null,
created_by: 'U060RNRCZ',
updated_by: 'U060RNRCZ',
deleted_by: null,
prefs: {
channels: [],
groups: [],
},
user_count: '0',
},
};

describe('Test SlackV2, userGroup => create', () => {
nock('https://slack.com').post('/api/usergroups.create').reply(200, API_RESPONSE);

new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"name": "slack tests",
"nodes": [
{
"parameters": {},
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
"name": "When clicking 'Execute workflow'",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [820, 360]
},
{
"parameters": {
"resource": "userGroup",
"operation": "create",
"name": "Marketing Team",
"Options": {
"channelIds": ["C08514ZPKB8"],
"description": "Marketing department user group",
"handle": "marketing",
"include_count": true
}
},
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
"name": "Slack",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.3,
"position": [1040, 360],
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
"credentials": {
"slackApi": {
"id": "Bg0bWXf8apAimCqJ",
"name": "Slack account 2"
}
}
},
{
"parameters": {},
"id": "06652908-6b8e-443a-9508-ab229b011b73",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [1260, 360]
}
],
"pinData": {
"No Operation, do nothing": [
{
"json": {
"auto_type": null,
"created_by": "U060RNRCZ",
"date_create": 1446746793,
"date_delete": 0,
"date_update": 1446746793,
"deleted_by": null,
"description": "Marketing gurus, PR experts and product advocates.",
"handle": "marketing-team",
"id": "S0615G0KT",
"is_external": false,
"is_usergroup": true,
"name": "Marketing Team",
"prefs": {
"channels": [],
"groups": []
},
"team_id": "T060RNRCH",
"updated_by": "U060RNRCZ",
"user_count": "0"
}
}
]
},
"connections": {
"When clicking 'Execute workflow'": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
]
]
},
"Slack": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "cf10cd01-6650-48ca-b4a2-ec07be9d026c",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
},
"id": "qJdEfiBgYLdfYOTs",
"tags": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';

const API_RESPONSE = {
ok: true,
usergroup: {
id: 'S07XXXXXX',
team_id: 'T1234567890',
is_usergroup: true,
is_subteam: true,
name: 'Marketing Team',
description: 'Marketing department user group',
handle: 'marketing',
is_external: false,
date_create: 1734322671,
date_update: 1734322671,
date_delete: 1734322800,
auto_type: null,
auto_provision: false,
enterprise_subteam_id: '',
created_by: 'U1234567890',
updated_by: 'U1234567890',
deleted_by: 'U1234567890',
prefs: {
channels: [],
groups: [],
},
users: [],
user_count: 0,
},
};

describe('Test SlackV2, userGroup => disable', () => {
nock('https://slack.com').post('/api/usergroups.disable').reply(200, API_RESPONSE);

new NodeTestHarness().setupTests({
workflowFiles: ['disable.workflow.json'],
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"name": "slack tests",
"nodes": [
{
"parameters": {},
"id": "e679c883-1839-47dc-9511-8f7dc370e6b0",
"name": "When clicking 'Execute workflow'",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [820, 360]
},
{
"parameters": {
"resource": "userGroup",
"operation": "disable",
"userGroupId": "S07XXXXXX",
"options": {
"include_count": true
}
},
"id": "2e1937a6-4c8f-4cd1-ae42-11b2bd12cc4c",
"name": "Slack",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.3,
"position": [1040, 360],
"webhookId": "04c5e584-45f4-48d0-bcd2-0ecacecb0f53",
"credentials": {
"slackApi": {
"id": "Bg0bWXf8apAimCqJ",
"name": "Slack account 2"
}
}
},
{
"parameters": {},
"id": "06652908-6b8e-443a-9508-ab229b011b73",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [1260, 360]
}
],
"pinData": {
"No Operation, do nothing": [
{
"json": {
"auto_provision": false,
"auto_type": null,
"created_by": "U1234567890",
"date_create": 1734322671,
"date_delete": 1734322800,
"date_update": 1734322671,
"deleted_by": "U1234567890",
"description": "Marketing department user group",
"enterprise_subteam_id": "",
"handle": "marketing",
"id": "S07XXXXXX",
"is_external": false,
"is_subteam": true,
"is_usergroup": true,
"name": "Marketing Team",
"prefs": {
"channels": [],
"groups": []
},
"team_id": "T1234567890",
"updated_by": "U1234567890",
"user_count": 0,
"users": []
}
}
]
},
"connections": {
"When clicking 'Execute workflow'": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
]
]
},
"Slack": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "cf10cd01-6650-48ca-b4a2-ec07be9d026c",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
},
"id": "qJdEfiBgYLdfYOTs",
"tags": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';

const API_RESPONSE = {
ok: true,
usergroup: {
id: 'S07XXXXXX',
team_id: 'T1234567890',
is_usergroup: true,
is_subteam: true,
name: 'Marketing Team',
description: 'Marketing department user group',
handle: 'marketing',
is_external: false,
date_create: 1734322671,
date_update: 1734322671,
date_delete: 0,
auto_type: null,
auto_provision: false,
enterprise_subteam_id: '',
created_by: 'U1234567890',
updated_by: 'U1234567890',
deleted_by: null,
prefs: {
channels: [],
groups: [],
},
users: [],
user_count: 0,
},
};

describe('Test SlackV2, userGroup => enable', () => {
nock('https://slack.com').post('/api/usergroups.enable').reply(200, API_RESPONSE);

new NodeTestHarness().setupTests({
workflowFiles: ['enable.workflow.json'],
});
});
Loading
Loading