diff --git a/tests/Unit/Node/UseCases/CreateNodeTest.php b/tests/Unit/Node/UseCases/CreateNodeTest.php index 68d4dfa..5b9226e 100644 --- a/tests/Unit/Node/UseCases/CreateNodeTest.php +++ b/tests/Unit/Node/UseCases/CreateNodeTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit\Node\UseCases; +use App\Exceptions\BadRequestException; use App\Node\Node; use App\Node\NodeRepository; use App\Node\UseCases\CreateNode; @@ -111,4 +112,28 @@ class CreateNodeTest extends TestCase parentNodeId: null, )); } + + public function test_throws_if_text_id_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('textId is required'); + + $this->useCase->execute(new CreateNodeRequest( + textId: null, + title: 'test', + parentNodeId: null, + )); + } + + public function test_throws_if_title_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('title is required'); + + $this->useCase->execute(new CreateNodeRequest( + textId: 0, + title: null, + parentNodeId: null, + )); + } }