Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
test(post): cover all 4 terminal statuses on MCP update + API update
Paulo Castellano0c955e885fc3
diff --git a/tests/Feature/Api/PostApiTest.php b/tests/Feature/Api/PostApiTest.phpindex 250439966..592ed2997 100644--- a/tests/Feature/Api/PostApiTest.php+++ b/tests/Feature/Api/PostApiTest.php@@ -196,11 +196,11 @@ it('cannot update post from another workspace', function () {->assertNotFound();});-it('cannot update published post', function () {+it('cannot update post in any terminal state', function (PostStatus $status) {$post = Post::factory()->create(['workspace_id' => $this->workspace->id,'user_id' => $this->user->id,- 'status' => PostStatus::Published,+ 'status' => $status,]);$postPlatform = PostPlatform::factory()->linkedin()->create([@@ -220,7 +220,12 @@ it('cannot update published post', function () {],])->assertUnprocessable();-});+})->with([+ PostStatus::Published,+ PostStatus::PartiallyPublished,+ PostStatus::Failed,+ PostStatus::Publishing,+]);it('validates post update fields', function () {$post = Post::factory()->create([diff --git a/tests/Feature/Mcp/PostPublishToolTest.php b/tests/Feature/Mcp/PostPublishToolTest.phpindex 7b269fdc2..91c517a76 100644--- a/tests/Feature/Mcp/PostPublishToolTest.php+++ b/tests/Feature/Mcp/PostPublishToolTest.php@@ -106,18 +106,23 @@ test('update post 404 from another workspace', function () {$response->assertHasErrors(['Post not found.']);});-test('update post rejects already-published post', function () {+test('update post rejects posts in any terminal state', function (PostStatus $status) {$post = Post::factory()->create(['workspace_id' => $this->workspace->id,'user_id' => $this->user->id,- 'status' => PostStatus::Published,+ 'status' => $status,]);$response = TryPostServer::actingAs($this->user)->tool(UpdatePostTool::class, ['post_id' => $post->id, 'content' => 'x']);$response->assertHasErrors(['Cannot edit a published post.']);-});+})->with([+ PostStatus::Published,+ PostStatus::PartiallyPublished,+ PostStatus::Failed,+ PostStatus::Publishing,+]);test('update post rejects a platforms[].id that belongs to another post', function () {$myPost = Post::factory()->create([