trypost/tests/Feature
Matteo Martini a33ff5d00f
fix: keep post drafts unscheduled by default (#209)
* fix: keep post drafts unscheduled by default

* Align schedule validation and keep drafts unscheduled.

Require scheduled_at only when status is scheduled and the post has no
usable future schedule. Share that rule across web, API, and MCP, keep
create without a date as null, and preserve the legacy date → 09:00 UTC
fallback.

* Polish schedule validation typing and tests.

Type requiresExplicitSchedule status as ?string, reuse a local status
variable in request/tool validation, tighten the web reject assertion,
and collapse overlapping MCP unscheduled-create cases.

* Centralize status helper in post update validation.

Reuse the typed status() helper across FormRequests and the already-parsed
$status in UpdatePostTool so schedule checks stay consistent and less noisy.

* Share scheduled_at update rules across web, API, and MCP.

Centralize schedule validation in PostStatusRules, normalize status parsing
in one place, and align past-schedule coverage across entry points.

* Cover the full unscheduled-draft checklist in Pest.

Add feature coverage for null/past schedule rejection, explicit scheduling,
draft saves, publish-now without a schedule, calendar exclusion, and
09:00 UTC date defaults across web, API, and MCP.

* Remove normalizeStatus helper.

Keep the inline is_string check at the few call sites that read raw
request status before validation — no shared wrapper needed.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Drop is_string status guards from schedule validation.

Accept mixed status in PostStatusRules and rely on strict comparisons
with Rule::requiredIf / Rule::when — malformed input simply does not match.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Paulo Castellano <paulo@castellanos.llc>
2026-08-01 17:39:18 -03:00
..
Actions Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Ai Harden created_via: require it, cover duplicate and all entry points. 2026-07-24 11:30:15 -03:00
Api fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
App/Post refactor(posts): return the card display domain from the backend 2026-07-17 16:24:23 -03:00
Auth Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Automation Enforce carousel min slides in Generate and expose min_media_count on API/MCP. 2026-07-24 23:51:10 -03:00
Billing Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Brand Structure brand voice and make generated copy platform-aware 2026-06-12 17:09:39 -03:00
Commands Give Instagram/Threads a wider proactive-refresh window 2026-07-03 10:33:26 -03:00
Database test(auth): cover remaining surfaces of the registration gate 2026-05-19 12:03:41 -03:00
Discord fix(channels): restrict Discord picker to postable channels the bot can use 2026-06-16 16:34:02 -03:00
Image Harden automations module: full-post generation, reliable runs, editor UX 2026-06-10 20:45:01 -03:00
Jobs Capture post.created to PostHog with created_via. 2026-07-24 11:44:47 -03:00
Listeners Capture post.created to PostHog with created_via. 2026-07-24 11:44:47 -03:00
Mcp fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
Middleware Share a ContentLanguageOption type and close the review's test gaps 2026-07-03 19:28:28 -03:00
Migrations refactor(linkedin): infer post format from media + unify account connection 2026-06-24 21:05:09 -03:00
Models refactor(billing): replace MonthlyCreditsLimit Pennant feature with BillingCycle 2026-06-22 09:55:03 -03:00
Observers Dispatch PostCreated from PostObserver on every create. 2026-07-24 12:01:01 -03:00
Onboarding feat(onboarding): add "where you found us" referral-source step 2026-07-18 16:07:11 -03:00
Permissions Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Services Clamp media byte caps to upload limits and surface truncated board lists. 2026-07-24 22:49:04 -03:00
Settings Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Social fix(security): make SSRF private-network block configurable and guard the last user-URL fetches 2026-07-17 15:40:15 -03:00
SocialAccount fix: merge-readiness — close two billing/network bugs, harden tests 2026-06-22 09:26:31 -03:00
Workspace feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
AcceptInviteControllerTest.php Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
AccountControllerTest.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
AiUsageLogTest.php feat: per-workspace pricing, onboarding, and billing overhaul 2026-06-21 20:40:03 -03:00
ApiKeyControllerTest.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
AssetControllerTest.php fix(security): make SSRF private-network block configurable and guard the last user-URL fetches 2026-07-17 15:40:15 -03:00
BillingControllerTest.php refactor: address code review for per-workspace pricing 2026-06-21 21:28:47 -03:00
ChunkedAssetReceiverTest.php test: cover ChunkedAssetReceiver and ChunkReceipt paths 2026-07-23 11:51:13 -03:00
ChunkedCloudUploadTest.php refactor: harden chunked cloud uploads after full PR review 2026-07-23 11:16:39 -03:00
ChunkedUploadFilenameEncodingTest.php fix: stream chunked video finalize to object storage 2026-07-23 10:55:57 -03:00
ContentTypeMediaRulesShareTest.php Restore media-rule parity and release failed MCP upload tokens. 2026-07-24 22:37:57 -03:00
ExampleTest.php
GitHubAuthToggleTest.php feat(auth): self-hosted registration gate + admin seeder (closes #46) 2026-05-19 11:45:16 -03:00
GoogleAuthToggleTest.php feat(auth): self-hosted registration gate + admin seeder (closes #46) 2026-05-19 11:45:16 -03:00
InstagramFacebookIntegrationTest.php feat: add PostCommentCreated broadcast event 2026-04-15 20:11:36 -03:00
InvitePermissionTest.php refactor: address code review for per-workspace pricing 2026-06-21 21:28:47 -03:00
LocalizationParityTest.php Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
NotificationControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PlanSeederTest.php feat: per-workspace pricing, onboarding, and billing overhaul 2026-06-21 20:40:03 -03:00
PlanTest.php chore: remove legacy plan tiers (starter/plus/pro/max) 2026-06-22 15:31:32 -03:00
PostCommentControllerTest.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
PostControllerTest.php fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
PostMediaAltTextValidationTest.php Harden per-image alt text across publishers, validation, and attach paths 2026-07-16 13:55:33 -03:00
PostSearchTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PostTemplateControllerTest.php fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
SignupSuccessControllerTest.php
SocialAccountModelTest.php Keep Instagram/Threads tokens extended while still valid 2026-07-03 09:18:45 -03:00
SocialAccountToggleTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
SocialControllerTest.php fix(linkedin): show connected company page on the accounts and onboarding grids 2026-06-24 21:23:27 -03:00
SocialLoginControllerTest.php refactor: address third-pass review nits 2026-06-22 08:39:25 -03:00
TikTokI18nStringsTest.php fix(tiktok): align UX strings and render processing notice for app review 2026-05-29 10:16:04 -03:00
UpdatePostRequestTest.php feat(channels): add Discord as a social channel 2026-06-16 14:44:00 -03:00
UsageControllerTest.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
VerifyWorkspaceConnectionsTest.php fix(social): move Mastodon default instance to config + cleanup 2026-05-19 08:27:46 -03:00
WorkspaceBillingTest.php feat(onboarding): require connecting a social network before checkout 2026-06-22 12:31:44 -03:00
WorkspaceControllerTest.php Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
WorkspaceInviteControllerTest.php Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
WorkspaceInviteGuardTest.php Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
WorkspaceLabelControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
WorkspaceSignatureControllerTest.php chore: remove deprecated localization files 2026-05-03 15:23:25 -03:00
YouTubeAnalyticsTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00