1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Default chapter templates: Updated api docs and tests

Also applied minor tweaks to some wording and logic.

During review of #4750
This commit is contained in:
Dan Brown
2024-02-01 12:22:16 +00:00
parent 4a8f70240f
commit 4137cf9c8f
10 changed files with 46 additions and 40 deletions

View File

@@ -35,6 +35,7 @@ class ChaptersApiTest extends TestCase
{
$this->actingAsApiEditor();
$book = $this->entities->book();
$templatePage = $this->entities->templatePage();
$details = [
'name' => 'My API chapter',
'description' => 'A chapter created via the API',
@@ -46,6 +47,7 @@ class ChaptersApiTest extends TestCase
],
],
'priority' => 15,
'default_template_id' => $templatePage->id,
];
$resp = $this->postJson($this->baseEndpoint, $details);
@@ -147,6 +149,7 @@ class ChaptersApiTest extends TestCase
'name' => $page->name,
],
],
'default_template_id' => null,
]);
$resp->assertJsonCount($chapter->pages()->count(), 'pages');
}
@@ -155,6 +158,7 @@ class ChaptersApiTest extends TestCase
{
$this->actingAsApiEditor();
$chapter = $this->entities->chapter();
$templatePage = $this->entities->templatePage();
$details = [
'name' => 'My updated API chapter',
'description' => 'A chapter updated via the API',
@@ -165,6 +169,7 @@ class ChaptersApiTest extends TestCase
],
],
'priority' => 15,
'default_template_id' => $templatePage->id,
];
$resp = $this->putJson($this->baseEndpoint . "/{$chapter->id}", $details);