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

@@ -195,6 +195,8 @@ class AdminAppWebsiteExtraControllerTest extends TestCase
$this->patchJson('/api/v1/adminapp/tenant/website-extras/contactConfig/toggle')
->assertOk()
->assertJsonPath('code', 'tenant.website_extra_toggled')
->assertJsonPath('message', 'El estado de la sección se actualizó correctamente.')
->assertJsonPath('data.definitions.contactConfig.is_enabled', true);
$this->assertTrue($websiteExtra->refresh()->is_enabled);
@@ -206,13 +208,21 @@ class AdminAppWebsiteExtraControllerTest extends TestCase
$this->assertFalse($websiteExtra->refresh()->is_enabled);
}
public function test_toggle_returns_not_found_for_an_extra_without_a_tenant_value(): void
public function test_toggle_enables_an_extra_without_a_tenant_value(): void
{
$tenant = $this->createTenant('acme');
Sanctum::actingAs($this->createAdminAppUser($tenant));
$this->patchJson('/api/v1/adminapp/tenant/website-extras/contactConfig/toggle')
->assertNotFound();
->assertOk()
->assertJsonPath('data.definitions.contactConfig.is_enabled', true)
->assertJsonPath('data.extras.contactConfig', []);
$this->assertDatabaseHas('websites_extras', [
'website_code' => $tenant->codigo,
'website_type_extra_id' => $this->websiteType->extras()->firstOrFail()->id,
'is_enabled' => true,
]);
}
private function createTenant(string $code): Tenant