Update guest PWA v2 UI and likes
This commit is contained in:
@@ -368,6 +368,38 @@ class GuestJoinTokenFlowTest extends TestCase
|
||||
$this->assertEquals(1, $photo->fresh()->likes_count);
|
||||
}
|
||||
|
||||
public function test_guest_can_unlike_photo_after_liking(): void
|
||||
{
|
||||
$event = $this->createPublishedEvent();
|
||||
$token = $this->tokenService->createToken($event);
|
||||
|
||||
$photo = Photo::factory()->create([
|
||||
'event_id' => $event->id,
|
||||
'likes_count' => 0,
|
||||
]);
|
||||
|
||||
$this->getJson("/api/v1/events/{$token->token}");
|
||||
|
||||
$this->withHeader('X-Device-Id', 'device-like')
|
||||
->postJson("/api/v1/photos/{$photo->id}/like")
|
||||
->assertOk();
|
||||
|
||||
$response = $this->withHeader('X-Device-Id', 'device-like')
|
||||
->deleteJson("/api/v1/photos/{$photo->id}/like");
|
||||
|
||||
$response->assertOk()
|
||||
->assertJson([
|
||||
'liked' => false,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('photo_likes', [
|
||||
'photo_id' => $photo->id,
|
||||
'guest_name' => 'device-like',
|
||||
]);
|
||||
|
||||
$this->assertEquals(0, $photo->fresh()->likes_count);
|
||||
}
|
||||
|
||||
public function test_guest_cannot_access_event_with_expired_token(): void
|
||||
{
|
||||
$event = $this->createPublishedEvent();
|
||||
|
||||
Reference in New Issue
Block a user