UNPKG

@tiberriver256/mcp-server-azure-devops

Version:

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

64 lines 2.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const feature_1 = require("./feature"); const feature_2 = require("../get-wikis/feature"); const test_helpers_1 = require("@/shared/test/test-helpers"); const environment_1 = require("@/utils/environment"); process.env.AZURE_DEVOPS_DEFAULT_PROJECT = process.env.AZURE_DEVOPS_DEFAULT_PROJECT || 'default-project'; describe('getWikiPage integration', () => { let connection = null; let projectName; let orgUrl; beforeAll(async () => { // Mock the required environment variable for testing process.env.AZURE_DEVOPS_ORG_URL = process.env.AZURE_DEVOPS_ORG_URL || 'https://example.visualstudio.com'; // Get a real connection using environment variables connection = await (0, test_helpers_1.getTestConnection)(); // Get and validate required environment variables const envProjectName = process.env.AZURE_DEVOPS_DEFAULT_PROJECT; if (!envProjectName) { throw new Error('AZURE_DEVOPS_DEFAULT_PROJECT environment variable is required'); } projectName = envProjectName; const envOrgUrl = process.env.AZURE_DEVOPS_ORG_URL; if (!envOrgUrl) { throw new Error('AZURE_DEVOPS_ORG_URL environment variable is required'); } orgUrl = envOrgUrl; }); test('should retrieve a wiki page', async () => { // Skip if no connection is available if ((0, test_helpers_1.shouldSkipIntegrationTest)()) { return; } // This connection must be available if we didn't skip if (!connection) { throw new Error('Connection should be available when test is not skipped'); } // First get available wikis const wikis = await (0, feature_2.getWikis)(connection, { projectId: projectName }); // Skip if no wikis are available if (wikis.length === 0) { console.log('Skipping test: No wikis available in the project'); return; } // Use the first available wiki const wiki = wikis[0]; if (!wiki.name) { throw new Error('Wiki name is undefined'); } // Get the wiki page const result = await (0, feature_1.getWikiPage)({ organizationId: (0, environment_1.getOrgNameFromUrl)(orgUrl), projectId: projectName, wikiId: wiki.name, pagePath: '/test', }); // Verify the result expect(result).toBeDefined(); expect(typeof result).toBe('string'); }); }); //# sourceMappingURL=feature.spec.int.js.map