n8n-nodes-highlevelv2
Version:
n8n community node for HighLevel v2 API integration - comprehensive CRM, marketing automation, and business management platform
37 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const GenericFunctions_1 = require("../GenericFunctions");
describe('getPipelines', () => {
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 pipelines', async () => {
const mockPipelines = [
{ id: '1', name: 'Pipeline A' },
{ id: '2', name: 'Pipeline B' },
];
mockHighLevelApiRequest.mockResolvedValue({ pipelines: mockPipelines });
mockGetCredentials.mockResolvedValue({ oauthTokenData: { locationId: '123' } });
const response = await GenericFunctions_1.getPipelines.call(mockContext);
expect(response).toEqual([
{ name: 'Pipeline A', value: '1' },
{ name: 'Pipeline B', value: '2' },
]);
});
it('should handle empty pipelines list', async () => {
mockHighLevelApiRequest.mockResolvedValue({ pipelines: [] });
mockGetCredentials.mockResolvedValue({ oauthTokenData: { locationId: '123' } });
const response = await GenericFunctions_1.getPipelines.call(mockContext);
expect(response).toEqual([]);
});
});
//# sourceMappingURL=GetPipelines.test.js.map