+ public function test_shelf_create_new_book()
+ {
+ $shelf = Bookshelf::first();
+ $resp = $this->asEditor()->get($shelf->getUrl('/create-book'));
+
+ $resp->assertSee('Create New Book');
+ $resp->assertSee($shelf->getShortName());
+
+ $testName = 'Test Book in Shelf Name';
+
+ $createBookResp = $this->asEditor()->post($shelf->getUrl('/create-book'), [
+ 'name' => $testName,
+ 'description' => 'Book in shelf description'
+ ]);
+ $createBookResp->assertRedirect();
+
+ $newBook = Book::query()->orderBy('id', 'desc')->first();
+ $this->assertDatabaseHas('bookshelves_books', [
+ 'bookshelf_id' => $shelf->id,
+ 'book_id' => $newBook->id,
+ ]);
+
+ $resp = $this->asEditor()->get($shelf->getUrl());
+ $resp->assertSee($testName);
+ }
+