create(['name' => 'Author One']); $contentType = ContentType::create([ 'name' => 'Wallpapers', 'slug' => 'wallpapers', 'description' => 'Wallpapers content type', ]); $category = Category::create([ 'content_type_id' => $contentType->id, 'name' => 'Abstract', 'slug' => 'abstract', 'description' => 'Abstract wallpapers', 'is_active' => true, 'sort_order' => 1, ]); $artwork = Artwork::factory() ->for($user) ->create([ 'slug' => 'neon-city', 'published_at' => now()->subDay(), ]); $artwork->categories()->attach($category->id); $response = $this->getJson('/api/v1/browse'); $response->assertOk() ->assertJsonPath('data.0.slug', 'neon-city') ->assertJsonPath('data.0.category.slug', 'abstract') ->assertJsonPath('data.0.author.name', 'Author One'); } public function test_web_browse_shows_artworks(): void { $user = User::factory()->create(['name' => 'Author Two']); $contentType = ContentType::create([ 'name' => 'Photography', 'slug' => 'photography', 'description' => 'Photos', ]); $category = Category::create([ 'content_type_id' => $contentType->id, 'name' => 'Nature', 'slug' => 'nature', 'description' => 'Nature photos', 'is_active' => true, 'sort_order' => 1, ]); $artwork = Artwork::factory() ->for($user) ->create([ 'title' => 'Forest Light', 'slug' => 'forest-light', 'published_at' => now()->subDay(), ]); $artwork->categories()->attach($category->id); $response = $this->get('/browse'); $response->assertOk(); $response->assertSee('Forest Light'); $response->assertSee('Author Two'); } }