diff --git a/tests/Unit/Node/UseCases/BulkCreateNodesTest.php b/tests/Unit/Node/UseCases/BulkCreateNodesTest.php index b3f6240..13072db 100644 --- a/tests/Unit/Node/UseCases/BulkCreateNodesTest.php +++ b/tests/Unit/Node/UseCases/BulkCreateNodesTest.php @@ -2,6 +2,7 @@ namespace Tests\Unit\Node\UseCases; +use App\Exceptions\BadRequestException; use App\Node\CreateNodeDto; use App\Node\Node; use App\Node\UseCases\BulkCreateNodes; @@ -131,4 +132,56 @@ class BulkCreateNodesTest extends TestCase count: 5, )); } + + public function test_throws_if_text_id_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('textId is required'); + + $this->useCase->execute(new BulkCreateNodesRequest( + textId: null, + parentNodeId: $this->parentNode->getId(), + titlePrefix: 'Page', + count: 5, + )); + } + + public function test_throws_if_parent_node_id_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('parentNodeId is required'); + + $this->useCase->execute(new BulkCreateNodesRequest( + textId: 0, + parentNodeId: null, + titlePrefix: 'Page', + count: 5, + )); + } + + public function test_throws_if_title_prefix_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('titlePrefix is required'); + + $this->useCase->execute(new BulkCreateNodesRequest( + textId: 0, + parentNodeId: $this->parentNode->getId(), + titlePrefix: null, + count: 5, + )); + } + + public function test_throws_if_count_is_null(): void + { + $this->expectException(BadRequestException::class); + $this->expectExceptionMessage('count is required'); + + $this->useCase->execute(new BulkCreateNodesRequest( + textId: 0, + parentNodeId: $this->parentNode->getId(), + titlePrefix: 'Page', + count: null, + )); + } }