test that error is thrown if plan doesnt exist for creating scheduled node

This commit is contained in:
Yisroel Baum 2026-02-25 10:21:05 +02:00
parent 449df516ae
commit 2affd2a84e
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 20 additions and 1 deletions

View file

@ -11,6 +11,7 @@ use App\ScheduledNode\UseCases\CreateScheduledNodeRequest;
use App\User\User;
use App\ValueObjects\EmailAddress;
use DateTimeImmutable;
use DomainException;
use Tests\Fakes\FakePlanRepository;
use Tests\Fakes\FakeScheduledNodeRepository;
use PHPUnit\Framework\TestCase;
@ -62,4 +63,16 @@ class CreateScheduledNodeTest extends TestCase
);
$this->assertInstanceOf(Plan::class, $scheduledNode->getPlan());
}
public function test_nonexistant_plan_throws(): void
{
$this->expectException(DomainException::class);
$this->expectExceptionMessage('Plan with id: 1 doesnt exist');
$this->useCase->execute(
new CreateScheduledNodeRequest(
date: new DateTimeImmutable('now'),
planId: 1,
)
);
}
}