TenantAtlas/tests/Unit/Badges/BooleanEnabledBadgesTest.php
ahmido 1bc6600fcc feat: tag badge catalog (060) (#72)
Summary:

completes Feature 060 by adding the suite-wide TagBadge catalog (spec/domain/renderer) plus migration notes/tests/docs/specs/plan/checklist.
standardizes all inert “tag-like” badges (policy type/category/platform, tenant environment, backup schedule frequency, etc.) to use the new catalog so only neutral colors are emitted.
fixes remaining Feature 059 regressions (inventory run/restore badges, Inventory Coverage tables, Boolean-enabled streak) and adds the BooleanEnabled badge mappings/guards/tests plus new QA tasks/checklist.
Testing:

BooleanEnabledBadgesTest.php
PolicyGeneralViewTest.php
PolicySettingsStandardViewTest.php
SettingsCatalogPolicyNormalizedDisplayTest.php
PolicyViewSettingsCatalogReadableTest.php (partial/visual checks skipped)
TagBadgeCatalogTest.php
TagBadgePaletteInvariantTest.php
NoForbiddenTagBadgeColorsTest.php
NoAdHocStatusBadgesTest.php
Manual QA per quickstart.md confirmed.
Next steps:

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local>
Reviewed-on: #72
2026-01-23 23:05:55 +00:00

28 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps enabled/disabled values to canonical badge semantics', function (mixed $value, string $label, string $color, ?string $icon): void {
$spec = BadgeCatalog::spec(BadgeDomain::BooleanEnabled, $value);
expect($spec->label)->toBe($label);
expect($spec->color)->toBe($color);
expect($spec->icon)->toBe($icon);
})->with([
'bool true' => [true, 'Enabled', 'success', 'heroicon-m-check-circle'],
'bool false' => [false, 'Disabled', 'gray', 'heroicon-m-minus-circle'],
'int 1' => [1, 'Enabled', 'success', 'heroicon-m-check-circle'],
'int 0' => [0, 'Disabled', 'gray', 'heroicon-m-minus-circle'],
'string enabled' => ['enabled', 'Enabled', 'success', 'heroicon-m-check-circle'],
'string disabled' => ['disabled', 'Disabled', 'gray', 'heroicon-m-minus-circle'],
'string yes' => ['yes', 'Enabled', 'success', 'heroicon-m-check-circle'],
'string no' => ['no', 'Disabled', 'gray', 'heroicon-m-minus-circle'],
'string true' => ['true', 'Enabled', 'success', 'heroicon-m-check-circle'],
'string false' => ['false', 'Disabled', 'gray', 'heroicon-m-minus-circle'],
'string 1' => ['1', 'Enabled', 'success', 'heroicon-m-check-circle'],
'string 0' => ['0', 'Disabled', 'gray', 'heroicon-m-minus-circle'],
]);