TenantAtlas/tests/Unit/Badges/VerificationBadgesTest.php
ahmido 439248ba15 feat: verification report framework (074) (#89)
Implements the 074 verification checklist framework.

Highlights:
- Versioned verification report contract stored in operation_runs.context.verification_report (DB-only viewer).
- Strict sanitizer/redaction (evidence pointers only; no tokens/headers/payloads) + schema validation.
- Centralized BADGE-001 semantics for check status, severity, and overall report outcome.
- Deterministic start (dedupe while active) via shared StartVerification service; capability-first authorization (non-member 404, member missing capability 403).
- Completion audit event (verification.completed) with redacted metadata.
- Integrations: OperationRun detail viewer, onboarding wizard verification step, provider connection start surfaces.

Tests:
- vendor/bin/sail artisan test --compact tests/Feature/Verification tests/Unit/Badges/VerificationBadgesTest.php
- vendor/bin/sail bin pint --dirty

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box>
Reviewed-on: #89
2026-02-03 23:58:17 +00:00

69 lines
2.7 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps verification check status values to canonical badge semantics', function (): void {
$pass = BadgeCatalog::spec(BadgeDomain::VerificationCheckStatus, 'pass');
expect($pass->label)->toBe('Pass');
expect($pass->color)->toBe('success');
$fail = BadgeCatalog::spec(BadgeDomain::VerificationCheckStatus, 'fail');
expect($fail->label)->toBe('Fail');
expect($fail->color)->toBe('danger');
$warn = BadgeCatalog::spec(BadgeDomain::VerificationCheckStatus, 'warn');
expect($warn->label)->toBe('Warn');
expect($warn->color)->toBe('warning');
$skip = BadgeCatalog::spec(BadgeDomain::VerificationCheckStatus, 'skip');
expect($skip->label)->toBe('Skipped');
expect($skip->color)->toBe('gray');
$running = BadgeCatalog::spec(BadgeDomain::VerificationCheckStatus, 'running');
expect($running->label)->toBe('Running');
expect($running->color)->toBe('info');
});
it('maps verification check severity values to canonical badge semantics', function (): void {
$info = BadgeCatalog::spec(BadgeDomain::VerificationCheckSeverity, 'info');
expect($info->label)->toBe('Info');
expect($info->color)->toBe('gray');
$low = BadgeCatalog::spec(BadgeDomain::VerificationCheckSeverity, 'low');
expect($low->label)->toBe('Low');
expect($low->color)->toBe('info');
$medium = BadgeCatalog::spec(BadgeDomain::VerificationCheckSeverity, 'medium');
expect($medium->label)->toBe('Medium');
expect($medium->color)->toBe('warning');
$high = BadgeCatalog::spec(BadgeDomain::VerificationCheckSeverity, 'high');
expect($high->label)->toBe('High');
expect($high->color)->toBe('danger');
$critical = BadgeCatalog::spec(BadgeDomain::VerificationCheckSeverity, 'critical');
expect($critical->label)->toBe('Critical');
expect($critical->color)->toBe('danger');
});
it('maps verification report overall values to canonical badge semantics', function (): void {
$ready = BadgeCatalog::spec(BadgeDomain::VerificationReportOverall, 'ready');
expect($ready->label)->toBe('Ready');
expect($ready->color)->toBe('success');
$needsAttention = BadgeCatalog::spec(BadgeDomain::VerificationReportOverall, 'needs_attention');
expect($needsAttention->label)->toBe('Needs attention');
expect($needsAttention->color)->toBe('warning');
$blocked = BadgeCatalog::spec(BadgeDomain::VerificationReportOverall, 'blocked');
expect($blocked->label)->toBe('Blocked');
expect($blocked->color)->toBe('danger');
$running = BadgeCatalog::spec(BadgeDomain::VerificationReportOverall, 'running');
expect($running->label)->toBe('Running');
expect($running->color)->toBe('info');
});