test element descriptions

This commit is contained in:
Yisroel Baum 2026-05-26 21:10:42 +03:00
parent a317f24976
commit f2dc1483dd
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 80 additions and 1 deletions

View file

@ -26,15 +26,22 @@ class ElementControllerTest extends TestCase
public function testShowReturnsElementPayload(): void
{
$set = $this->createSet(1, 'Baderech');
$element = $this->createElement($set, 'Baderech HaAvodah', null);
$element = $this->createElement(
$set,
'Baderech HaAvodah',
'A structured path for growth',
null,
);
$firstChildElement = $this->createElement(
$set,
'Avodah Foundations',
'Foundations for steady avodah',
$element,
);
$secondChildElement = $this->createElement(
$set,
'Daily Practice',
'Daily practices for growth',
$element,
);
@ -44,14 +51,20 @@ class ElementControllerTest extends TestCase
$body = json_decode($response->getContent(), true);
$this->assertSame($element->getId(), $body['element']['id']);
$this->assertSame('Baderech HaAvodah', $body['element']['title']);
$this->assertSame(
'A structured path for growth',
$body['element']['description'],
);
$this->assertSame([
[
'id' => $firstChildElement->getId(),
'title' => 'Avodah Foundations',
'description' => 'Foundations for steady avodah',
],
[
'id' => $secondChildElement->getId(),
'title' => 'Daily Practice',
'description' => 'Daily practices for growth',
],
], $body['childElements']);
}
@ -91,11 +104,13 @@ class ElementControllerTest extends TestCase
private function createElement(
DomainSet $set,
string $title,
string $description,
?Element $parentElement,
): Element {
return $this->elementRepo->create(new CreateElementDto(
set: $set,
title: $title,
description: $description,
parentElement: $parentElement,
));
}