@tiberriver256/mcp-server-azure-devops
Version:
Azure DevOps reference server for the Model Context Protocol (MCP)
64 lines • 2.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const feature_1 = require("./feature");
const test_helpers_1 = require("@/shared/test/test-helpers");
describe('listProjects integration', () => {
let connection = null;
beforeAll(async () => {
// Get a real connection using environment variables
connection = await (0, test_helpers_1.getTestConnection)();
});
test('should list projects in the organization', 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');
}
// Act - make an actual API call to Azure DevOps
const result = await (0, feature_1.listProjects)(connection);
// Assert on the actual response
expect(result).toBeDefined();
expect(Array.isArray(result)).toBe(true);
// Check structure of returned items (even if empty)
if (result.length > 0) {
const firstProject = result[0];
expect(firstProject.id).toBeDefined();
expect(firstProject.name).toBeDefined();
expect(firstProject.url).toBeDefined();
expect(firstProject.state).toBeDefined();
}
});
test('should apply pagination options', 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');
}
const options = {
top: 2, // Only get up to 2 projects
};
// Act - make an actual API call to Azure DevOps
const result = await (0, feature_1.listProjects)(connection, options);
// Assert on the actual response
expect(result).toBeDefined();
expect(Array.isArray(result)).toBe(true);
expect(result.length).toBeLessThanOrEqual(2);
// If we have projects, check for correct limit
if (result.length > 0) {
// Get all projects to compare
const allProjects = await (0, feature_1.listProjects)(connection);
// If we have more than 2 total projects, pagination should have limited results
if (allProjects.length > 2) {
expect(result.length).toBe(2);
expect(result.length).toBeLessThan(allProjects.length);
}
}
});
});
//# sourceMappingURL=feature.spec.int.js.map