UNPKG

@tiberriver256/mcp-server-azure-devops

Version:

Azure DevOps reference server for the Model Context Protocol (MCP)

69 lines 3.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const feature_1 = require("./feature"); const feature_2 = require("../list-pipelines/feature"); const test_helpers_1 = require("../../../shared/test/test-helpers"); describe('getPipeline integration', () => { let connection = null; let projectId; let existingPipelineId = null; beforeAll(async () => { // Get a real connection using environment variables connection = await (0, test_helpers_1.getTestConnection)(); // Get the project ID from environment variables, fallback to default projectId = process.env.AZURE_DEVOPS_DEFAULT_PROJECT || 'DefaultProject'; // Skip if no connection or project is available if ((0, test_helpers_1.shouldSkipIntegrationTest)() || !connection || !projectId) { return; } // Try to get an existing pipeline ID for testing try { const pipelines = await (0, feature_2.listPipelines)(connection, { projectId }); if (pipelines.length > 0) { existingPipelineId = pipelines[0].id ?? null; } } catch (error) { console.log('Could not find existing pipelines for testing:', error); } }); test('should get a pipeline by ID', async () => { // Skip if no connection, project, or pipeline ID is available if ((0, test_helpers_1.shouldSkipIntegrationTest)() || !connection || !projectId || !existingPipelineId) { console.log('Skipping getPipeline integration test - no connection, project or existing pipeline available'); return; } // Act - make an API call to Azure DevOps const pipeline = await (0, feature_1.getPipeline)(connection, { projectId, pipelineId: existingPipelineId, }); // Assert expect(pipeline).toBeDefined(); expect(pipeline.id).toBe(existingPipelineId); expect(pipeline.name).toBeDefined(); expect(typeof pipeline.name).toBe('string'); expect(pipeline.folder).toBeDefined(); expect(pipeline.revision).toBeDefined(); expect(pipeline.url).toBeDefined(); expect(pipeline.url).toContain('_apis/pipelines'); }); test('should throw ResourceNotFoundError for non-existent pipeline', async () => { // Skip if no connection or project is available if ((0, test_helpers_1.shouldSkipIntegrationTest)() || !connection || !projectId) { console.log('Skipping getPipeline error test - no connection or project available'); return; } // Use a very high ID that is unlikely to exist const nonExistentPipelineId = 999999; // Act & Assert - should throw a not found error await expect((0, feature_1.getPipeline)(connection, { projectId, pipelineId: nonExistentPipelineId, })).rejects.toThrow(/not found/); }); }); //# sourceMappingURL=feature.spec.int.js.map