2026-05-24 12:17:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
2026-06-10 20:26:50 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-05-24 12:17:19 +00:00
|
|
|
use App\Actions\Automation\Node\RunEndNode;
|
|
|
|
|
use App\Enums\Automation\NodeRun\Status;
|
|
|
|
|
use App\Models\AutomationRun;
|
|
|
|
|
|
|
|
|
|
it('returns completed with ended_at timestamp', function () {
|
|
|
|
|
$run = AutomationRun::factory()->create();
|
|
|
|
|
|
|
|
|
|
$result = app(RunEndNode::class)($run, []);
|
|
|
|
|
|
|
|
|
|
expect($result->status)->toBe(Status::Completed);
|
|
|
|
|
expect($result->output)->toHaveKey('end');
|
|
|
|
|
expect($result->output['end'])->toHaveKey('ended_at');
|
|
|
|
|
expect($result->output['end']['reason'])->toBeNull();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('captures reason from config', function () {
|
|
|
|
|
$run = AutomationRun::factory()->create();
|
|
|
|
|
|
|
|
|
|
$result = app(RunEndNode::class)($run, ['reason' => 'Filtered out']);
|
|
|
|
|
|
|
|
|
|
expect($result->output['end']['reason'])->toBe('Filtered out');
|
|
|
|
|
});
|