add notifications logic and add support of both JWT and Sanctum
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Resources\Notifications;
|
||||
|
||||
use App\Http\Resources\Notifications\UserNotificationResource;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UserNotificationResourceTest extends TestCase
|
||||
{
|
||||
public function test_resource_returns_expected_shape(): void
|
||||
{
|
||||
$resource = new UserNotificationResource([
|
||||
'notification_id' => 10,
|
||||
'title' => 'Title',
|
||||
'message' => 'Message',
|
||||
'priority' => 'high',
|
||||
'scheduled_at' => '2025-01-01 00:00:00',
|
||||
'expires_at' => '2025-01-02 00:00:00',
|
||||
'target_group' => 'parent',
|
||||
'is_read' => 1,
|
||||
]);
|
||||
|
||||
$payload = $resource->toArray(request());
|
||||
|
||||
$this->assertArrayHasKey('notification_id', $payload);
|
||||
$this->assertArrayHasKey('title', $payload);
|
||||
$this->assertArrayHasKey('message', $payload);
|
||||
$this->assertArrayHasKey('priority', $payload);
|
||||
$this->assertArrayHasKey('scheduled_at', $payload);
|
||||
$this->assertArrayHasKey('expires_at', $payload);
|
||||
$this->assertArrayHasKey('target_group', $payload);
|
||||
$this->assertArrayHasKey('is_read', $payload);
|
||||
$this->assertTrue($payload['is_read']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user