Featured artworks thumbnails

This commit is contained in:
2026-05-06 19:11:31 +02:00
parent 82f2b1f660
commit 0c5dde9b22
36 changed files with 55994 additions and 30 deletions

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
use App\Models\Artwork;
use App\Models\ArtworkComment;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('renders the latest comments page', function (): void {
$author = User::factory()->create();
$artwork = Artwork::factory()->for($author)->create();
ArtworkComment::factory()->for($artwork)->for($author)->create([
'content' => 'Latest comments page regression comment',
'raw_content' => 'Latest comments page regression comment',
'rendered_content' => '<p>Latest comments page regression comment</p>',
'created_at' => now()->subMinutes(5),
]);
$this->get(route('legacy.latest_comments'))
->assertOk()
->assertSee('Latest Comments');
});
it('returns latest comments api data', function (): void {
$author = User::factory()->create();
$artwork = Artwork::factory()->for($author)->create([
'title' => 'Latest Comments Artwork',
'slug' => 'latest-comments-artwork',
]);
$comment = ArtworkComment::factory()->for($artwork)->for($author)->create([
'content' => 'Latest comments api regression comment',
'raw_content' => 'Latest comments api regression comment',
'rendered_content' => '<p>Latest comments api regression comment</p>',
'created_at' => now()->subMinutes(10),
]);
$this->getJson(route('api.comments.latest'))
->assertOk()
->assertJsonPath('data.0.comment_id', $comment->id)
->assertJsonPath('data.0.commenter.id', $author->id)
->assertJsonPath('data.0.artwork.id', $artwork->id)
->assertJsonPath('meta.total', 1);
});