trypost/tests/Feature/ContentTypeMediaRulesShareTest.php
Paulo Castellano 3d4a42c7b0 Share content-type video duration caps to the frontend via Inertia.
Keep ContentType as the single source of truth and stop hardcoding maxVideoDurationSec in useMediaRules.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 21:36:53 -03:00

27 lines
1 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.facebook_reel.max_video_duration_sec', 90)
->where('contentTypeMediaRules.tiktok_video.max_video_duration_sec', null)
);
});