UNPKG

n8n-nodes-highlevelv2

Version:

n8n community node for HighLevel v2 API integration - comprehensive CRM, marketing automation, and business management platform

47 lines 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const GenericFunctions_1 = require("../GenericFunctions"); describe('dueDatePreSendAction', () => { let mockThis; beforeEach(() => { mockThis = { getNode: jest.fn(() => ({ id: 'mock-node-id', name: 'mock-node', typeVersion: 1, type: 'n8n-nodes-base.mockNode', position: [0, 0], parameters: {}, })), getNodeParameter: jest.fn(), getInputData: jest.fn(), helpers: {}, }; jest.clearAllMocks(); }); it('should add formatted dueDate to requestOptions.body if dueDate is provided directly', async () => { mockThis.getNodeParameter.mockReturnValueOnce('2024-12-25'); const requestOptions = { url: 'https://example.com/api' }; const result = await GenericFunctions_1.dueDatePreSendAction.call(mockThis, requestOptions); expect(result.body).toEqual({ dueDate: '2024-12-25T00:00:00+00:00' }); }); it('should add formatted dueDate to requestOptions.body if dueDate is provided in updateFields', async () => { mockThis.getNodeParameter.mockImplementation((paramName) => { if (paramName === 'dueDate') return null; if (paramName === 'updateFields') return { dueDate: '2024-12-25' }; return undefined; }); const requestOptions = { url: 'https://example.com/api' }; const result = await GenericFunctions_1.dueDatePreSendAction.call(mockThis, requestOptions); expect(result.body).toEqual({ dueDate: '2024-12-25T00:00:00+00:00' }); }); it('should initialize body as an empty object if it is undefined', async () => { mockThis.getNodeParameter.mockReturnValueOnce('2024-12-25'); const requestOptions = { url: 'https://example.com/api', body: undefined }; const result = await GenericFunctions_1.dueDatePreSendAction.call(mockThis, requestOptions); expect(result.body).toEqual({ dueDate: '2024-12-25T00:00:00+00:00' }); }); }); //# sourceMappingURL=DueDatePreSendAction.test.js.map