feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -3,9 +3,12 @@
declare(strict_types=1);
use App\Models\User;
use App\Models\Artwork;
use App\Models\Group;
use App\Services\ArtworkService;
use App\Services\HomepageService;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Cache;
beforeEach(function () {
// Use null Scout driver — Meilisearch calls return empty results gracefully
@@ -16,6 +19,9 @@ beforeEach(function () {
$artworksMock->shouldReceive('getFeaturedArtworks')
->andReturn(new LengthAwarePaginator(collect(), 0, 1))
->byDefault();
$artworksMock->shouldReceive('getFeaturedArtworkWinner')
->andReturn(null)
->byDefault();
app()->instance(ArtworkService::class, $artworksMock);
});
@@ -78,3 +84,34 @@ it('guest and auth homepages have different key sets', function () {
expect(in_array('from_following', $auth))->toBeTrue();
expect(in_array('from_following', $guest))->toBeFalse();
});
it('homepage artwork payload uses group name and avatar for group-published artworks', function () {
$owner = User::factory()->create();
$group = Group::factory()->create([
'owner_user_id' => $owner->id,
'name' => 'Skinbase Collective',
'slug' => 'skinbase-collective',
]);
Artwork::factory()->create([
'user_id' => $owner->id,
'group_id' => $group->id,
'published_as_type' => Artwork::PUBLISHED_AS_GROUP,
'title' => 'Group Published Artwork',
'hash' => 'homepagegroupartwork',
'thumb_ext' => 'webp',
'published_at' => now()->subMinute(),
]);
Cache::flush();
$items = app(HomepageService::class)->getFreshUploads(10);
expect($items)->not->toBeEmpty()
->and($items[0]['author'])->toBe('Skinbase Collective')
->and($items[0]['author_username'])->toBe('')
->and($items[0]['published_as_type'])->toBe(Artwork::PUBLISHED_AS_GROUP)
->and($items[0]['publisher']['type'])->toBe('group')
->and($items[0]['publisher']['name'])->toBe('Skinbase Collective')
->and($items[0]['publisher']['profile_url'])->toContain('/groups/skinbase-collective');
});