n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
63 lines (52 loc) • 1.92 kB
text/typescript
// tests/monitoring/ap.test.ts
import { getAPs } from '../../api/monitoring/ap/operations/getAPs.methods';
import { getBSSIDs } from '../../api/monitoring/ap/operations/getBSSIDs.methods';
import { deleteAP } from '../../api/monitoring/ap/operations/deleteAP.methods';
import { getAPDetails } from '../../api/monitoring/ap/operations/getAPDetails.methods';
import { getAPRFSummary } from '../../api/monitoring/ap/operations/getAPRFSummary.methods';
import { getAPBandwidthUsage } from '../../api/monitoring/ap/operations/getAPBandwidthUsage.methods';
import { getTopNAPs } from '../../api/monitoring/ap/operations/getTopNAPs.methods';
import { apiRequest } from '../../helpers/apiRequest';
// Mock the apiRequest helper
jest.mock('../../helpers/apiRequest');
describe('AP 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('getAPs', () => {
it('should call API with correct parameters', async () => {
mockExecuteFunction.getNodeParameter.mockReturnValueOnce({ limit: 10, status: 'Up' }); // additionalFields
await getAPs.call(mockExecuteFunction);
expect(apiRequest).toHaveBeenCalledWith(
mockExecuteFunction,
'GET',
'/monitoring/v1/aps',
{},
{
limit: 10,
status: 'Up',
},
);
});
});
describe('deleteAP', () => {
it('should call API with correct parameters', async () => {
mockExecuteFunction.getNodeParameter.mockReturnValueOnce('ABCDEF123456'); // serialNumber
await deleteAP.call(mockExecuteFunction);
expect(apiRequest).toHaveBeenCalledWith(
mockExecuteFunction,
'DELETE',
'/monitoring/v1/aps/ABCDEF123456',
);
});
});
// Add tests for other AP operations
});