test set root ids
This commit is contained in:
parent
070722e013
commit
a87c98a729
1 changed files with 12 additions and 0 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Element\CreateElementDto;
|
||||
use App\Element\ElementRepository;
|
||||
use App\Set\CreateSetDto;
|
||||
use App\Set\SetRepository;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
|
@ -14,6 +16,7 @@ class SetsEndpointTest extends TestCase
|
|||
public function testReturnsAllSets(): void
|
||||
{
|
||||
$setRepository = app(SetRepository::class);
|
||||
$elementRepository = app(ElementRepository::class);
|
||||
$baderechSet = $setRepository->create(new CreateSetDto(
|
||||
name: 'Baderech HaAvodah',
|
||||
description: 'Baderech HaAvodah is a way of living',
|
||||
|
|
@ -24,6 +27,13 @@ class SetsEndpointTest extends TestCase
|
|||
description: 'Daily learning for steady growth',
|
||||
iconImageUrl: '/assets/daily-learning-icon.svg',
|
||||
));
|
||||
$baderechRootElement = $elementRepository->create(
|
||||
new CreateElementDto(
|
||||
set: $baderechSet,
|
||||
title: $baderechSet->getName(),
|
||||
parentElement: null,
|
||||
)
|
||||
);
|
||||
|
||||
$response = $this->getJson('/api/sets');
|
||||
|
||||
|
|
@ -35,12 +45,14 @@ class SetsEndpointTest extends TestCase
|
|||
'name' => $baderechSet->getName(),
|
||||
'description' => $baderechSet->getDescription(),
|
||||
'iconImageUrl' => $baderechSet->getIconImageUrl(),
|
||||
'rootElementId' => $baderechRootElement->getId(),
|
||||
],
|
||||
[
|
||||
'id' => $dailyLearningSet->getId(),
|
||||
'name' => $dailyLearningSet->getName(),
|
||||
'description' => $dailyLearningSet->getDescription(),
|
||||
'iconImageUrl' => $dailyLearningSet->getIconImageUrl(),
|
||||
'rootElementId' => null,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue