]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ChaptersApiTest.php
Merge branch 'chapter-templates' into development
[bookstack] / tests / Api / ChaptersApiTest.php
index fdb80a4973eb761dfbb65437337314da4628ccb3..e2d6cfc81f0a8ce5e12172c7f4c793787feff2e4 100644 (file)
@@ -22,11 +22,12 @@ 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,
             ],
         ]]);
     }
@@ -132,6 +133,7 @@ class ChaptersApiTest extends TestCase
         $resp->assertJson([
             'id'         => $chapter->id,
             'slug'       => $chapter->slug,
+            'book_slug'  => $chapter->book->slug,
             'created_by' => [
                 'name' => $chapter->createdBy->name,
             ],
@@ -151,6 +153,7 @@ class ChaptersApiTest extends TestCase
             ],
             'default_template_id' => null,
         ]);
+        $resp->assertJsonMissingPath('book');
         $resp->assertJsonCount($chapter->pages()->count(), 'pages');
     }