trypost/tests/Feature/Automation/Command/FireScheduleTriggersTest.php
Paulo Castellano b23ab0166e feat(automations): implement automation features and UI enhancements
- Added new automation-related routes and controllers for managing automations.
- Introduced automation nodes in the UI with distinct styles and interactions.
- Updated sidebar to include navigation for automations.
- Enhanced post creation logic to support automation metadata.
- Refactored content type and platform enums into types for better type safety.
- Added localization for automation-related terms in English, Spanish, and Portuguese.
- Improved error handling in various components to accommodate new features.
2026-05-24 09:17:19 -03:00

19 lines
784 B
PHP

<?php
declare(strict_types=1);
use App\Models\Automation;
use App\Models\AutomationTriggerItem;
it('fires only schedule-trigger automations whose cron matches', function () {
$scheduleAutomation = Automation::factory()->active()->create([
'nodes' => [['id' => 't', 'type' => 'trigger', 'position' => ['x' => 0, 'y' => 0],
'data' => ['trigger_type' => 'schedule', 'cron' => '* * * * *']]],
]);
$rssAutomation = Automation::factory()->active()->withScheduleTrigger()->create();
$this->artisan('automation:fire-schedule')->assertSuccessful();
expect(AutomationTriggerItem::where('automation_id', $scheduleAutomation->id)->count())->toBe(1);
expect(AutomationTriggerItem::where('automation_id', $rssAutomation->id)->count())->toBe(0);
});