Refine SEO, uploads, and deploy handling

This commit is contained in:
2026-05-02 10:48:08 +02:00
parent b6be6ed2ac
commit a9dfa6ea11
97 changed files with 373 additions and 327 deletions

View File

@@ -5,33 +5,17 @@ declare(strict_types=1);
use App\Models\Artwork;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use function Pest\Laravel\actingAs;
use function Pest\Laravel\postJson;
uses(RefreshDatabase::class);
it('returns normalized synchronous vision tag suggestions for the artwork owner', function (): void {
it('returns a disabled payload for the artwork owner while synchronous vision suggestions are off', function (): void {
config()->set('vision.enabled', true);
config()->set('vision.gateway.base_url', 'https://vision.local');
config()->set('cdn.files_url', 'https://files.local');
$user = User::factory()->create();
$artwork = Artwork::factory()->create([
'user_id' => $user->id,
'hash' => 'aabbcc112233',
]);
Http::fake([
'https://vision.local/analyze/all' => Http::response([
'clip' => [
['tag' => 'Neon City', 'confidence' => 0.91],
['tag' => 'Night Sky', 'confidence' => 0.77],
],
'yolo' => [
['label' => 'car', 'confidence' => 0.65],
],
], 200),
]);
actingAs($user);
@@ -39,24 +23,18 @@ it('returns normalized synchronous vision tag suggestions for the artwork owner'
$response = postJson('/api/uploads/' . $artwork->id . '/vision-suggest?limit=10');
$response->assertOk()
->assertJsonPath('vision_enabled', true)
->assertJsonPath('source', 'gateway_sync')
->assertJsonPath('tags.0.slug', 'neon-city')
->assertJsonPath('tags.0.source', 'clip')
->assertJsonPath('tags.1.slug', 'night-sky')
->assertJsonPath('tags.2.slug', 'car');
->assertJsonPath('vision_enabled', false)
->assertJsonPath('reason', 'disabled')
->assertJsonPath('tags', []);
});
it('returns 404 when a non-owner requests upload vision suggestions', function (): void {
config()->set('vision.enabled', true);
config()->set('vision.gateway.base_url', 'https://vision.local');
config()->set('cdn.files_url', 'https://files.local');
$owner = User::factory()->create();
$viewer = User::factory()->create();
$artwork = Artwork::factory()->create([
'user_id' => $owner->id,
'hash' => 'aabbcc112233',
]);
actingAs($viewer);