UNPKG

archunit

Version:

ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app

33 lines 1.94 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const metrics_1 = require("../../src/metrics"); require("../../index"); describe('LCOM metrics project summary', () => { const mockProjectPath = path_1.default.join(__dirname, 'mock-project', 'tsconfig.json'); it('should calculate project-wide LCOM metrics summary', async () => { // Get project summary for LCOM metrics const projectSummary = await (0, metrics_1.metrics)(mockProjectPath).lcom().summary(); // Verify we have valid project metrics expect(projectSummary).toBeDefined(); expect(projectSummary.totalClasses).toBeGreaterThan(0); // Verify that all average metrics are valid numbers expect(projectSummary.averageLCOM96a).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM96b).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM96b).toBeLessThanOrEqual(1); expect(projectSummary.averageLCOM1).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM2).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM3).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM4).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOM5).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOMStar).toBeGreaterThanOrEqual(0); expect(projectSummary.averageLCOMStar).toBeLessThanOrEqual(1); // Verify high cohesion class count is valid expect(projectSummary.highCohesionClassCount).toBeGreaterThanOrEqual(0); expect(projectSummary.highCohesionClassCount).toBeLessThanOrEqual(projectSummary.totalClasses); }); }); //# sourceMappingURL=lcom-project-summary.spec.js.map