feat(website-extras): add showExtra method and resource for individual website extras, update routes and tests
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user