TenantAtlas/tests/Feature/Badges/TenantStatusBadgeTest.php

27 lines
942 B
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps every canonical tenant lifecycle to an explicit badge', function (string $input, string $label, string $color): void {
$spec = BadgeCatalog::spec(BadgeDomain::TenantStatus, $input);
expect($spec->label)->toBe($label)
->and($spec->color)->toBe($color);
})->with([
'draft' => ['draft', 'Draft', 'gray'],
'onboarding' => ['onboarding', 'Onboarding', 'warning'],
'active' => ['active', 'Active', 'success'],
'archived' => ['archived', 'Archived', 'gray'],
]);
it('normalizes legacy tenant lifecycle aliases before mapping', function (): void {
$pending = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'PENDING');
$inactive = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'inactive');
expect($pending->label)->toBe('Onboarding')
->and($inactive->label)->toBe('Archived');
});