test element siblings

This commit is contained in:
Yisroel Baum 2026-06-21 22:36:29 +03:00
parent 90d28deffb
commit eb868679c8
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 258 additions and 0 deletions

View file

@ -94,6 +94,74 @@ class ElementsEndpointTest extends TestCase
'longPdfPath' => '/assets/pdfs/baderech-long.pdf',
'youtubeUrl' => $sampleYoutubeUrl,
],
'siblingElements' => [
[
'id' => $element->getId(),
'title' => 'Baderech HaAvodah',
'description' => 'A structured path for growth',
],
],
]);
}
public function testReturnsSameParentSiblingElements(): void
{
$setRepository = app(SetRepository::class);
$elementRepository = app(ElementRepository::class);
$set = $this->createSet($setRepository);
$parentElement = $this->createElement(
$elementRepository,
$set,
'Baderech HaAvodah',
'A structured path for growth',
null,
'',
null,
null,
null,
null,
);
$firstChildElement = $this->createElement(
$elementRepository,
$set,
'Avodah Foundations',
'Foundations for steady avodah',
null,
'<p>Foundations rich text</p>',
null,
null,
null,
$parentElement,
);
$secondChildElement = $this->createElement(
$elementRepository,
$set,
'Daily Practice',
'Daily practices for growth',
null,
'',
null,
null,
null,
$parentElement,
);
$response = $this->getJson(
"/api/elements/{$firstChildElement->getId()}"
);
$response->assertOk();
$response->assertJsonPath('siblingElements', [
[
'id' => $firstChildElement->getId(),
'title' => 'Avodah Foundations',
'description' => 'Foundations for steady avodah',
],
[
'id' => $secondChildElement->getId(),
'title' => 'Daily Practice',
'description' => 'Daily practices for growth',
],
]);
}