trypost/tests/Feature/ContentTypeMediaRulesShareTest.php
Paulo Castellano 7b986fca9c Centralize content-type media rules on the ContentType enum.
Share the full editor rule set (sizes, durations, accepts, aspect bounds) via Inertia so useMediaRules no longer hardcodes MB/GB math, and expose per-type byte caps on API/MCP content-type listings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 22:01:48 -03:00

30 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Enums\UserWorkspace\Role;
use App\Models\User;
use App\Models\Workspace;
use Inertia\Testing\AssertableInertia;
beforeEach(function () {
$this->user = User::factory()->create();
$this->workspace = Workspace::factory()->create(['user_id' => $this->user->id]);
$this->workspace->members()->attach($this->user->id, ['role' => Role::Member->value]);
$this->user->update(['current_workspace_id' => $this->workspace->id]);
});
test('inertia shares content type media rules for the frontend', function () {
$this->actingAs($this->user)
->get(route('app.posts.index'))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->has('contentTypeMediaRules')
->where('contentTypeMediaRules.instagram_reel.max_video_duration_sec', 900)
->where('contentTypeMediaRules.instagram_reel.max_video_bytes', 1 * 1024 * 1024 * 1024)
->where('contentTypeMediaRules.instagram_reel.accept_images', false)
->where('contentTypeMediaRules.facebook_reel.max_video_duration_sec', 90)
->where('contentTypeMediaRules.tiktok_video.max_video_duration_sec', null)
->where('contentTypeMediaRules.linkedin_post.max_document_bytes', 100 * 1024 * 1024)
);
});