]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ChaptersApiTest.php
respective book and chapter structure added.
[bookstack] / tests / Api / ChaptersApiTest.php
index fdb80a4973eb761dfbb65437337314da4628ccb3..9698d4dd9c254dea3ba5d3e1a6390bd61033b84d 100644 (file)
@@ -22,11 +22,15 @@ class ChaptersApiTest extends TestCase
         $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');
         $resp->assertJson(['data' => [
             [
-                'id'       => $firstChapter->id,
-                'name'     => $firstChapter->name,
-                'slug'     => $firstChapter->slug,
-                'book_id'  => $firstChapter->book->id,
-                'priority' => $firstChapter->priority,
+                'id'        => $firstChapter->id,
+                'name'      => $firstChapter->name,
+                'slug'      => $firstChapter->slug,
+                'book_id'   => $firstChapter->book->id,
+                'priority'  => $firstChapter->priority,
+                'book_slug' => $firstChapter->book->slug,
+                'owned_by'   => $firstChapter->owned_by,
+                'created_by' => $firstChapter->created_by,
+                'updated_by' => $firstChapter->updated_by,
             ],
         ]]);
     }
@@ -132,6 +136,7 @@ class ChaptersApiTest extends TestCase
         $resp->assertJson([
             'id'         => $chapter->id,
             'slug'       => $chapter->slug,
+            'book_slug'  => $chapter->book->slug,
             'created_by' => [
                 'name' => $chapter->createdBy->name,
             ],
@@ -147,10 +152,21 @@ class ChaptersApiTest extends TestCase
                     'id'   => $page->id,
                     'slug' => $page->slug,
                     'name' => $page->name,
+                    'owned_by' => $page->owned_by,
+                    'created_by' => $page->created_by,
+                    'updated_by' => $page->updated_by,
+                    'book_id' => $page->id,
+                    'chapter_id' => $chapter->id,
+                    'priority' => $page->priority,
+                    'book_slug' => $chapter->book->slug,
+                    'draft' => $page->draft,
+                    'template' => $page->template,
+                    'editor' => $page->editor,
                 ],
             ],
             'default_template_id' => null,
         ]);
+        $resp->assertJsonMissingPath('book');
         $resp->assertJsonCount($chapter->pages()->count(), 'pages');
     }