UNPKG

n8n-nodes-arubacentral

Version:

n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities

55 lines (47 loc) 1.85 kB
// tests/monitoring/client.test.ts import { getUnifiedClients } from '../../api/monitoring/client/operations/getUnifiedClients.methods'; import { getClientDetails } from '../../api/monitoring/client/operations/getClientDetails.methods'; import { getClientMobilityTrail } from '../../api/monitoring/client/operations/getClientMobilityTrail.methods'; import { getClientBandwidthUsage } from '../../api/monitoring/client/operations/getClientBandwidthUsage.methods'; import { getTopNClients } from '../../api/monitoring/client/operations/getTopNClients.methods'; import { getClientsCount } from '../../api/monitoring/client/operations/getClientsCount.methods'; import { apiRequest } from '../../helpers/apiRequest'; // Mock the apiRequest helper jest.mock('../../helpers/apiRequest'); describe('Client Resource Operations', () => { let mockExecuteFunction: any; beforeEach(() => { jest.clearAllMocks(); mockExecuteFunction = { getNodeParameter: jest.fn(), helpers: { returnJsonArray: (data: any) => [{ json: data }], }, }; (apiRequest as jest.Mock).mockResolvedValue({ count: 1 }); }); describe('getUnifiedClients', () => { it('should call API with correct parameters', async () => { mockExecuteFunction.getNodeParameter .mockReturnValueOnce('3H') // timerange .mockReturnValueOnce('WIRELESS') // clientType .mockReturnValueOnce('CONNECTED') // clientStatus .mockReturnValueOnce({ limit: 10, showUsage: true }); // additionalFields await getUnifiedClients.call(mockExecuteFunction); expect(apiRequest).toHaveBeenCalledWith( mockExecuteFunction, 'GET', '/monitoring/v2/clients', {}, { timerange: '3H', client_type: 'WIRELESS', client_status: 'CONNECTED', limit: 10, show_usage: true, }, ); }); }); // Add tests for other client operations });