Show a level-based notice on /upload without revealing the internal approved-artwork threshold, and mention the usual 48-hour review window.
64 lines
1.9 KiB
PHP
64 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Artwork;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Inertia\Testing\AssertableInertia as Assert;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('warns newer creators on the upload page without revealing the internal threshold', function (): void {
|
|
$user = User::factory()->create([
|
|
'role' => 'user',
|
|
'level' => 1,
|
|
'created_at' => now()->subYear(),
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/upload')
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Upload/Index')
|
|
->where('requires_upload_review', true)
|
|
->missing('approved_uploads')
|
|
->missing('reasons'))
|
|
->assertDontSee('insufficient_approved_uploads', false)
|
|
->assertDontSee('minimum_approved_uploads', false);
|
|
});
|
|
|
|
it('does not show the new-creator review warning for trusted uploaders', function (): void {
|
|
$user = User::factory()->create([
|
|
'role' => 'user',
|
|
'level' => 1,
|
|
'created_at' => now()->subYear(),
|
|
]);
|
|
|
|
Artwork::factory()->for($user)->count(5)->create([
|
|
'is_approved' => true,
|
|
'is_public' => true,
|
|
'artwork_status' => 'published',
|
|
'published_at' => now()->subDay(),
|
|
'approval_source' => null,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get('/upload')
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Upload/Index')
|
|
->where('requires_upload_review', false));
|
|
});
|
|
|
|
it('does not show the new-creator review warning for admins', function (): void {
|
|
$admin = User::factory()->create(['role' => 'admin']);
|
|
|
|
$this->actingAs($admin)
|
|
->get('/upload')
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Upload/Index')
|
|
->where('requires_upload_review', false));
|
|
});
|