- 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.
26 lines
925 B
PHP
26 lines
925 B
PHP
<?php
|
|
|
|
use App\Actions\Automation\Node\RunDelayNode;
|
|
use App\Enums\Automation\NodeRun\Status;
|
|
use App\Models\AutomationRun;
|
|
|
|
it('returns sleep_until with duration in hours', function () {
|
|
$run = AutomationRun::factory()->create();
|
|
$handler = app(RunDelayNode::class);
|
|
|
|
$result = $handler($run, ['duration' => 2, 'unit' => 'hours']);
|
|
|
|
expect($result->status)->toBe(Status::Completed);
|
|
expect($result->sleepUntil)->not->toBeNull();
|
|
expect(now()->diffInMinutes($result->sleepUntil))->toBeGreaterThanOrEqual(119);
|
|
});
|
|
|
|
it('supports minutes and days units', function () {
|
|
$run = AutomationRun::factory()->create();
|
|
$handler = app(RunDelayNode::class);
|
|
|
|
expect($handler($run, ['duration' => 30, 'unit' => 'minutes'])->sleepUntil)
|
|
->not->toBeNull();
|
|
expect(now()->diffInHours($handler($run, ['duration' => 1, 'unit' => 'days'])->sleepUntil))
|
|
->toBeGreaterThanOrEqual(23);
|
|
});
|