feat(website-type): add new color fields and update related methods in WebsiteType model and service

This commit is contained in:
2026-07-31 12:55:40 -03:00
parent 6858b387c3
commit b478c23f3b
7 changed files with 164 additions and 18 deletions

View File

@@ -2,9 +2,11 @@
namespace Tests\Feature\Seeders;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Tenant\Models\WebsiteType;
use Database\Seeders\WebsiteTypeSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class WebsiteTypeSeederTest extends TestCase
@@ -13,10 +15,26 @@ class WebsiteTypeSeederTest extends TestCase
public function test_it_seeds_website_types_and_their_config_schemas_idempotently(): void
{
Storage::fake('s3');
$this->seed(WebsiteTypeSeeder::class);
$this->seed(WebsiteTypeSeeder::class);
$this->assertSame(2, WebsiteType::query()->count());
$this->assertSame(2, Attachment::query()->count());
$expectedPresentation = [
'primary_color' => '#FF7006',
'secondary_color' => '#777777',
'danger_color' => '#E04A4A',
'success_color' => '#81BC73',
'warning_color' => '#81BC73',
'body_color' => '#666666',
'darker_body_color' => '#333333',
'surface_color' => '#ffffff',
'background_color' => '#f8f8f8',
'border_color' => '#f8f8f8',
];
$shopIt = WebsiteType::query()
->where('codigo', 'shopit')
@@ -24,6 +42,9 @@ class WebsiteTypeSeederTest extends TestCase
->sole();
$this->assertSame('ShopIt', $shopIt->nombre);
$this->assertSame($expectedPresentation, $shopIt->only(array_keys($expectedPresentation)));
$this->assertSame('onticket_logo.png', $shopIt->siteLogo->filename);
Storage::disk('s3')->assertExists($shopIt->siteLogo->path);
$this->assertSame(['carousel'], $shopIt->extras->pluck('codigo')->all());
$this->assertSame('Carrusel principal', $shopIt->extras->sole()->nombre);
$this->assertSame([
@@ -45,6 +66,10 @@ class WebsiteTypeSeederTest extends TestCase
->sole();
$this->assertSame('OnTicket', $onTicket->nombre);
$this->assertSame($expectedPresentation, $onTicket->only(array_keys($expectedPresentation)));
$this->assertSame('onticket_logo.png', $onTicket->siteLogo->filename);
Storage::disk('s3')->assertExists($onTicket->siteLogo->path);
$this->assertNotSame($shopIt->site_logo, $onTicket->site_logo);
$this->assertEqualsCanonicalizing(
['heroConfig', 'eventConfig'],
$onTicket->extras->pluck('codigo')->all(),