UNPKG

n8n-nodes-highlevelv2

Version:

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

37 lines 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const GenericFunctions_1 = require("../GenericFunctions"); describe('getUsers', () => { const mockHighLevelApiRequest = jest.fn(); const mockGetCredentials = jest.fn(); const mockContext = { getCredentials: mockGetCredentials, helpers: { httpRequestWithAuthentication: mockHighLevelApiRequest, }, }; beforeEach(() => { mockHighLevelApiRequest.mockClear(); mockGetCredentials.mockClear(); }); it('should return a list of users', async () => { const mockUsers = [ { id: '1', name: 'John Doe', email: 'john.doe@example.com' }, { id: '2', name: 'Jane Smith', email: 'jane.smith@example.com' }, ]; mockHighLevelApiRequest.mockResolvedValue({ users: mockUsers }); mockGetCredentials.mockResolvedValue({ oauthTokenData: { locationId: '123' } }); const response = await GenericFunctions_1.getUsers.call(mockContext); expect(response).toEqual([ { name: 'John Doe', value: '1' }, { name: 'Jane Smith', value: '2' }, ]); }); it('should handle empty users list', async () => { mockHighLevelApiRequest.mockResolvedValue({ users: [] }); mockGetCredentials.mockResolvedValue({ oauthTokenData: { locationId: '123' } }); const response = await GenericFunctions_1.getUsers.call(mockContext); expect(response).toEqual([]); }); }); //# sourceMappingURL=GetUsers.test.js.map