feat(menu): update validation rules and structure for contact content in MenuSeeder and related tests
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Domains\Attachable\Enums\AttachmentType;
|
||||
use App\Domains\Attachable\Models\Attachment;
|
||||
use App\Domains\Menu\Models\Menu;
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use Database\Seeders\MenuSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -98,6 +99,43 @@ class TenantMenuControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_contact_content_requires_coordinates_inside_each_address(): void
|
||||
{
|
||||
$tenant = $this->createTenant();
|
||||
$this->seed(MenuSeeder::class);
|
||||
|
||||
$this->postJson("/api/{$tenant->codigo}/menues/help.contact", [
|
||||
'static_content' => [
|
||||
'whatsapp' => [
|
||||
'whatsapp_url' => 'https://wa.me/543412602222',
|
||||
'whatsapp_label' => 'Chatea con nosotros',
|
||||
],
|
||||
'phone' => '+54 9 (0341) 6658247',
|
||||
'locations' => [
|
||||
'rosario' => [
|
||||
'label' => 'Rosario',
|
||||
'addresses' => [
|
||||
[
|
||||
'label' => 'Av. San Lorenzo 1542',
|
||||
'address' => 'Av. San Lorenzo 1542, Rosario',
|
||||
'coordinates' => [-91, -181],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'map_locations' => [
|
||||
'legacy_point' => [-32.946820, -60.639320],
|
||||
],
|
||||
],
|
||||
])
|
||||
->assertUnprocessable()
|
||||
->assertJsonValidationErrors([
|
||||
'static_content.locations.rosario.addresses.0.coordinates.0',
|
||||
'static_content.locations.rosario.addresses.0.coordinates.1',
|
||||
'static_content.map_locations',
|
||||
]);
|
||||
}
|
||||
|
||||
private function createTenant(): Tenant
|
||||
{
|
||||
$headerLogo = $this->createAttachment('header.png');
|
||||
|
||||
Reference in New Issue
Block a user