test element siblings
This commit is contained in:
parent
90d28deffb
commit
eb868679c8
3 changed files with 258 additions and 0 deletions
|
|
@ -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',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue