Skip to content

Commit

Permalink
test fix, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed Jan 24, 2025
1 parent 1ad82a4 commit d781dee
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 80 deletions.
22 changes: 2 additions & 20 deletions packages/nodes-base/nodes/Google/Gmail/v2/GmailV2.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { labelFields, labelOperations } from './LabelDescription';
import { getGmailAliases, getLabels, getThreadMessages } from './loadOptions';
import { messageFields, messageOperations } from './MessageDescription';
import { threadFields, threadOperations } from './ThreadDescription';
import { sendAndWaitWebhooks } from '../../../../utils/sendAndWait/descriptions';
import type { IEmail } from '../../../../utils/sendAndWait/interfaces';
import {
configureWaitTillDate,
Expand Down Expand Up @@ -68,26 +69,7 @@ const versionDescription: INodeTypeDescription = {
},
},
],
webhooks: [
{
name: 'default',
httpMethod: 'GET',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
],
webhooks: sendAndWaitWebhooks,
properties: [
{
displayName: 'Authentication',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as folder from './folder';
import * as folderMessage from './folderMessage';
import * as message from './message';
import * as messageAttachment from './messageAttachment';
import { sendAndWaitWebhooks } from '../../../../../utils/sendAndWait/descriptions';

export const description: INodeTypeDescription = {
displayName: 'Microsoft Outlook',
Expand All @@ -30,26 +31,7 @@ export const description: INodeTypeDescription = {
required: true,
},
],
webhooks: [
{
name: 'default',
httpMethod: 'GET',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
],
webhooks: sendAndWaitWebhooks,
properties: [
{
displayName: 'Resource',
Expand Down
22 changes: 2 additions & 20 deletions packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { reactionFields, reactionOperations } from './ReactionDescription';
import { starFields, starOperations } from './StarDescription';
import { userFields, userOperations } from './UserDescription';
import { userGroupFields, userGroupOperations } from './UserGroupDescription';
import { sendAndWaitWebhooks } from '../../../utils/sendAndWait/descriptions';
import {
configureWaitTillDate,
getSendAndWaitProperties,
Expand Down Expand Up @@ -80,26 +81,7 @@ export class SlackV2 implements INodeType {
},
},
],
webhooks: [
{
name: 'default',
httpMethod: 'GET',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
],
webhooks: sendAndWaitWebhooks,
properties: [
{
displayName: 'Authentication',
Expand Down
22 changes: 2 additions & 20 deletions packages/nodes-base/nodes/Telegram/Telegram.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
getPropertyName,
} from './GenericFunctions';
import { appendAttributionOption } from '../../utils/descriptions';
import { sendAndWaitWebhooks } from '../../utils/sendAndWait/descriptions';
import {
configureWaitTillDate,
getSendAndWaitProperties,
Expand Down Expand Up @@ -48,26 +49,7 @@ export class Telegram implements INodeType {
required: true,
},
],
webhooks: [
{
name: 'default',
httpMethod: 'GET',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
],
webhooks: sendAndWaitWebhooks,
properties: [
{
displayName: 'Resource',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ describe('Test Telegram, message => sendAndWait', () => {
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({});
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce('approval');

// configureWaitTillDate
mockExecuteFunctions.getNodeParameter.mockReturnValueOnce({}); //options.limitWaitTime.values

const result = await telegram.execute.call(mockExecuteFunctions);

expect(result).toEqual([items]);
Expand Down
22 changes: 22 additions & 0 deletions packages/nodes-base/utils/sendAndWait/descriptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { IWebhookDescription } from 'n8n-workflow';

export const sendAndWaitWebhooks: IWebhookDescription[] = [
{
name: 'default',
httpMethod: 'GET',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
{
name: 'default',
httpMethod: 'POST',
responseMode: 'onReceived',
responseData: '',
path: '={{ $nodeId }}',
restartWebhook: true,
isFullPath: true,
},
];

0 comments on commit d781dee

Please sign in to comment.