mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(HighLevel Node): Add support for calendar items (#10820)
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import type { ILoadOptionsFunctions } from 'n8n-workflow';
|
||||
|
||||
import { getPipelines } from '../GenericFunctions';
|
||||
|
||||
describe('getPipelines', () => {
|
||||
const mockHighLevelApiRequest = jest.fn();
|
||||
const mockGetCredentials = jest.fn();
|
||||
const mockContext = {
|
||||
getCredentials: mockGetCredentials,
|
||||
helpers: {
|
||||
httpRequestWithAuthentication: mockHighLevelApiRequest,
|
||||
},
|
||||
} as unknown as ILoadOptionsFunctions;
|
||||
|
||||
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 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 getPipelines.call(mockContext);
|
||||
|
||||
expect(response).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user