trypost/tests/Feature/Middleware/EnsureHasWorkspaceTest.php
Paulo Castellano 49c77406a0 fix(linkedin): enforce carousel cap and fail loudly on processing timeout
- publishCarousel now caps images at the platform max so the API/MCP paths
  can't bypass the 10-image limit the UI enforces
- waitForProcessing throws on timeout instead of posting against an asset
  still being processed; poll attempts/interval extracted to overridable
  protected methods for testability
- scope EnsureHasWorkspace to connect entry points + disconnect only;
  session-driven OAuth callbacks/selects stay ungated so a missing current
  workspace can't HTML-redirect the popup instead of closing it cleanly
2026-06-25 15:34:03 -03:00

36 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\User;
use Inertia\Testing\AssertableInertia;
test('connect routes redirect to workspace creation when there is no current workspace', function () {
$user = User::factory()->create(['current_workspace_id' => null]);
$this->actingAs($user)
->get(route('app.social.x.connect'))
->assertRedirect(route('app.workspaces.create'));
});
test('connect routes require a workspace even in self-hosted mode', function () {
config()->set('trypost.self_hosted', true);
$user = User::factory()->create(['current_workspace_id' => null]);
$this->actingAs($user)
->get(route('app.social.x.connect'))
->assertRedirect(route('app.workspaces.create'));
});
test('oauth callbacks are not blocked by the workspace gate and self-close the popup', function () {
$user = User::factory()->create(['current_workspace_id' => null]);
$this->actingAs($user)
->get(route('app.social.x.callback'))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('accounts/PopupCallback')
->where('success', false),
);
});