+ 'cover' => null,
+ ],
+ ]]);
+ }
+
+ public function test_index_endpoint_includes_cover_if_set()
+ {
+ $this->actingAsApiEditor();
+ $shelf = $this->entities->shelf();
+
+ $baseRepo = $this->app->make(BaseRepo::class);
+ $image = $this->files->uploadedImage('shelf_cover');
+ $baseRepo->updateCoverImage($shelf, $image);
+
+ $resp = $this->getJson($this->baseEndpoint . '?filter[id]=' . $shelf->id);
+ $resp->assertJson(['data' => [
+ [
+ 'id' => $shelf->id,
+ 'cover' => [
+ 'id' => $shelf->cover->id,
+ 'url' => $shelf->cover->url,
+ ],