feat(website-extras): add showExtra method and resource for individual website extras, update routes and tests

This commit is contained in:
2026-07-31 09:51:27 -03:00
parent 40cbac17c6
commit 6dd057874a
4 changed files with 102 additions and 6 deletions

View File

@@ -84,6 +84,36 @@ class AdminAppWebsiteExtraControllerTest extends TestCase
->assertJsonPath('data.resolved_extras.contactConfig.phone', '+54 341 555 0101');
}
public function test_adminapp_user_can_read_one_website_extra(): void
{
$tenant = $this->createTenant('acme');
$definition = $this->websiteType->extras()->firstOrFail();
$tenant->websiteExtras()->create([
'website_type_extra_id' => $definition->id,
'config' => ['phone' => '+54 341 555 0101'],
'is_enabled' => true,
]);
Sanctum::actingAs($this->createAdminAppUser($tenant));
$this->getJson('/api/v1/adminapp/tenant/website-extras/contactConfig')
->assertOk()
->assertJsonPath('data.codigo', 'contactConfig')
->assertJsonPath('data.nombre', 'Configuración de contacto')
->assertJsonPath('data.is_enabled', true)
->assertJsonPath('data.config.phone', '+54 341 555 0101')
->assertJsonPath('data.resolved_config.phone', '+54 341 555 0101');
}
public function test_reading_an_unconfigured_website_extra_returns_not_found(): void
{
$tenant = $this->createTenant('acme');
Sanctum::actingAs($this->createAdminAppUser($tenant));
$this->getJson('/api/v1/adminapp/tenant/website-extras/contactConfig')
->assertNotFound();
}
public function test_adminapp_user_updates_one_extra_without_touching_other_tenants(): void
{
$tenant = $this->createTenant('acme');