28 lines
1.3 KiB
PHP
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'],
|
|
]);
|