feat: Enhance tenant website extras by adding detailed description HTML for hero and additional info configurations; update related tests for validation

This commit is contained in:
2026-08-03 15:29:14 -03:00
parent 3b36abd46d
commit 3b2977a330
3 changed files with 86 additions and 5 deletions

View File

@@ -170,6 +170,53 @@ class AdminAppWebsiteExtraControllerTest extends TestCase
);
}
public function test_adminapp_user_saves_the_banner_description_in_the_hero_extra(): void
{
$heroDefinition = $this->websiteType->extras()->create([
'codigo' => 'heroConfig',
'nombre' => 'Banner principal',
'descripcion' => 'Configuración del banner principal.',
'is_required' => false,
'config_schema' => [
'request_rules' => [
'$' => 'required|array',
'title_html' => 'nullable|string',
'description_html' => 'nullable|string',
'button_text' => 'nullable|string',
'button_href' => 'nullable|string',
'background_image_id' => 'nullable|string',
],
'transforms' => [],
],
]);
$tenant = $this->createTenant('acme');
Sanctum::actingAs($this->createAdminAppUser($tenant));
$this->putJson('/api/v1/adminapp/tenant/website-extras/heroConfig', [
'config' => [
'title_html' => '<h1>Evento</h1>',
'description_html' => '<p>Nueva descripción del banner</p>',
'button_text' => 'Comprar',
'button_href' => '/tickets',
'background_image_id' => null,
],
])
->assertOk()
->assertJsonPath(
'data.extras.heroConfig.description_html',
'<p>Nueva descripción del banner</p>'
);
$this->assertSame(
'<p>Nueva descripción del banner</p>',
$tenant->websiteExtras()
->where('website_type_extra_id', $heroDefinition->id)
->firstOrFail()
->config['description_html']
);
}
public function test_update_returns_not_found_for_an_unsupported_extra_code(): void
{
$tenant = $this->createTenant('acme');