/** * Integration tests for Testing Strategy MCP Server */ import { describe, it, expect, beforeEach, vi } from "vitest"; import * as fs from "fs"; import * as path from "path"; import XrayTestingStrategyServer from "./testing-strategy.server"; describe("testing-strategy.server integration", () => { describe("module exports", () => { it("should export a server class", () => { expect(XrayTestingStrategyServer).toBeDefined(); expect(typeof XrayTestingStrategyServer).toBe("function"); }); it("should be able to instantiate the server", () => { const server = new XrayTestingStrategyServer(); expect(server).toBeDefined(); }); it("should have run method", () => { const server = new XrayTestingStrategyServer(); expect(typeof server.run).toBe("function"); }); }); describe("server structure", () => { let server: XrayTestingStrategyServer; beforeEach(() => { server = new XrayTestingStrategyServer(); }); it("should instantiate correctly", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); it("should have run async method", () => { expect(server.run).toBeInstanceOf(Function); }); }); describe("test analysis functionality", () => { let server: XrayTestingStrategyServer; beforeEach(() => { server = new XrayTestingStrategyServer(); }); it("should analyze test coverage for project", () => { const projectRoot = process.cwd(); const exists = fs.existsSync(projectRoot); expect(exists).toBe(true); }); it("should have access to project files", () => { const projectRoot = process.cwd(); const packageJsonPath = path.join(projectRoot, "package.json"); const hasPackageJson = fs.existsSync(packageJsonPath); expect(hasPackageJson).toBe(true); }); }); describe("test strategy generation", () => { let server: XrayTestingStrategyServer; beforeEach(() => { server = new XrayTestingStrategyServer(); }); it("should handle web project type", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); it("should handle api project type", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); it("should handle mobile project type", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); }); describe("test gap identification", () => { let server: XrayTestingStrategyServer; beforeEach(() => { server = new XrayTestingStrategyServer(); }); it("should accept source files array", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); it("should accept existing tests array", () => { expect(server).toBeInstanceOf(XrayTestingStrategyServer); }); }); });