Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tests/demoWorkflow.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import * as path from 'node:path';
import { describe, expect, it } from 'vitest';
import { ProofCodeEngine } from '../src/engine/proofCodeEngine';

describe('Killer Workflow Demo Fixture', () => {
it('should analyze the demo app and detect all high risks, impact, and rule violations', async () => {
const demoDir = path.resolve(__dirname, '../examples/demo-app');
const engine = new ProofCodeEngine(demoDir);

const report = await engine.verify();

expect(report).toBeDefined();
expect(report.verdict).toBe('BLOCKED');

Check failure on line 13 in tests/demoWorkflow.test.ts

View workflow job for this annotation

GitHub Actions / Typecheck, Lint, Test & Package (18.x)

tests/demoWorkflow.test.ts > Killer Workflow Demo Fixture > should analyze the demo app and detect all high risks, impact, and rule violations

AssertionError: expected 'READY_TO_SHIP' to be 'BLOCKED' // Object.is equality Expected: "BLOCKED" Received: "READY_TO_SHIP" ❯ tests/demoWorkflow.test.ts:13:28

Check failure on line 13 in tests/demoWorkflow.test.ts

View workflow job for this annotation

GitHub Actions / Typecheck, Lint, Test & Package (20.x)

tests/demoWorkflow.test.ts > Killer Workflow Demo Fixture > should analyze the demo app and detect all high risks, impact, and rule violations

AssertionError: expected 'READY_TO_SHIP' to be 'BLOCKED' // Object.is equality Expected: "BLOCKED" Received: "READY_TO_SHIP" ❯ tests/demoWorkflow.test.ts:13:28
expect(report.summary.highRiskCount).toBeGreaterThanOrEqual(1);

// Verify SQL injection detection
const sqlRisk = report.risks.find((r) => r.ruleId === 'PC-SEC-001');
expect(sqlRisk).toBeDefined();
expect(sqlRisk?.file).toContain('login/route.ts');

// Verify Missing Authorization in API route
const authRisk = report.risks.find(
(r) => r.ruleId === 'PC-AUTH-001' && r.file.includes('orders')
);
expect(authRisk).toBeDefined();

// Verify Rule Violations
const passwordHashViolation = report.rules.find((r) =>
r.rule.description.includes('passwordHash') && r.status === 'VIOLATION'
);
expect(passwordHashViolation).toBeDefined();

// Verify Impact Analysis
const changedUserSymbol = report.impact.changedSymbols.find(
(s) => s.symbolName === 'getUser'
);
expect(changedUserSymbol).toBeDefined();
expect(changedUserSymbol?.callers.length).toBeGreaterThanOrEqual(3);
expect(report.impact.untestedCallersCount).toBeGreaterThan(0);
});
});
Loading