feat: add guest notification insights
This commit is contained in:
39
tests/Feature/Tenant/EventToolkitNotificationsTest.php
Normal file
39
tests/Feature/Tenant/EventToolkitNotificationsTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Tenant;
|
||||
|
||||
use App\Enums\GuestNotificationType;
|
||||
use App\Models\Event;
|
||||
use App\Models\GuestNotification;
|
||||
|
||||
class EventToolkitNotificationsTest extends TenantTestCase
|
||||
{
|
||||
public function test_toolkit_response_contains_notification_summary(): void
|
||||
{
|
||||
$event = Event::factory()->for($this->tenant)->create([
|
||||
'status' => 'published',
|
||||
'slug' => 'toolkit-event',
|
||||
]);
|
||||
|
||||
GuestNotification::factory()->create([
|
||||
'tenant_id' => $this->tenant->id,
|
||||
'event_id' => $event->id,
|
||||
'type' => GuestNotificationType::BROADCAST,
|
||||
'title' => 'Broadcast',
|
||||
]);
|
||||
|
||||
GuestNotification::factory()->create([
|
||||
'tenant_id' => $this->tenant->id,
|
||||
'event_id' => $event->id,
|
||||
'type' => GuestNotificationType::UPLOAD_ALERT,
|
||||
'title' => 'Upload Hinweis',
|
||||
]);
|
||||
|
||||
$response = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}/toolkit");
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('notifications.summary.total', 2);
|
||||
$response->assertJsonPath('notifications.summary.broadcasts.total', 1);
|
||||
$response->assertJsonCount(2, 'notifications.recent');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user