feat(website-extras): enhance toggle functionality and update related tests; add additional info configuration to tenant extras

This commit is contained in:
2026-08-03 09:10:50 -03:00
parent f1df6a5918
commit 4a51f3afde
10 changed files with 134 additions and 17 deletions

View File

@@ -84,12 +84,13 @@ class TenantSeederTest extends TestCase
$extras = $fiesta->websiteExtras->keyBy('websiteTypeExtra.codigo');
$this->assertEqualsCanonicalizing(
['heroConfig', 'eventConfig'],
['heroConfig', 'eventConfig', 'additionalInfoConfig'],
$extras->keys()->all(),
);
$heroConfig = $extras->get('heroConfig')->config;
$this->assertSame('<h1>Fiesta Fútbol Infantil</h1>', $heroConfig['title_html']);
$this->assertArrayNotHasKey('description_html', $heroConfig);
$this->assertIsInt($heroConfig['background_image_id']);
$this->assertDatabaseHas('attachments', [
'id' => $heroConfig['background_image_id'],
@@ -101,9 +102,21 @@ class TenantSeederTest extends TestCase
'location' => 'Rosario, Santa Fe',
'dates_text' => '9, 10, 11 y 12 de Octubre 2026',
'dates' => [
'2026-12-05',
'2026-12-06',
[
'date' => '2026-12-05',
'start_time' => '09:00',
'end_time' => '18:00',
],
[
'date' => '2026-12-06',
'start_time' => '09:00',
'end_time' => '18:00',
],
],
], $extras->get('eventConfig')->config);
$this->assertSame([
'description' => '<p>Viví una jornada inolvidable de fútbol infantil.</p>',
], $extras->get('additionalInfoConfig')->config);
}
}

View File

@@ -78,7 +78,7 @@ class WebsiteTypeSeederTest extends TestCase
$this->assertNotSame($shopIt->site_logo, $onTicket->site_logo);
$this->assertNotSame($shopIt->footer_logo, $onTicket->footer_logo);
$this->assertEqualsCanonicalizing(
['heroConfig', 'eventConfig'],
['heroConfig', 'eventConfig', 'additionalInfoConfig'],
$onTicket->extras->pluck('codigo')->all(),
);
@@ -108,9 +108,27 @@ class WebsiteTypeSeederTest extends TestCase
'location' => 'nullable|string',
'dates_text' => 'nullable|string|max:255',
'dates' => 'nullable|array',
'dates.*' => 'required|date_format:Y-m-d|distinct',
'dates.*' => 'required|array:date,start_time,end_time',
'dates.*.date' => 'required|date_format:Y-m-d|distinct',
'dates.*.start_time' => 'required|date_format:H:i',
'dates.*.end_time' => 'required|date_format:H:i',
'contact' => 'nullable|array:whatsapp_url,instagram_url,facebook_url',
'contact.whatsapp_url' => 'nullable|url|max:2048',
'contact.instagram_url' => 'nullable|url|max:2048',
'contact.facebook_url' => 'nullable|url|max:2048',
],
'transforms' => [],
], $eventSchema);
$additionalInfoSchema = $onTicket->extras
->firstWhere('codigo', 'additionalInfoConfig')
->config_schema;
$this->assertSame([
'request_rules' => [
'$' => 'required|array',
'description' => 'nullable|string',
],
'transforms' => [],
], $additionalInfoSchema);
}
}