create(); actingAs($user); $response = postJson('/api/artworks', [ 'title' => 'Upload draft test', 'description' => 'Draft body', 'is_mature' => false, ]); $response->assertCreated() ->assertJsonPath('status', 'draft'); $artworkId = (int) $response->json('artwork_id'); $artwork = Artwork::query()->findOrFail($artworkId); expect($artwork->visibility)->toBe(Artwork::VISIBILITY_PRIVATE) ->and($artwork->is_public)->toBeFalse() ->and($artwork->artwork_status)->toBe('draft') ->and($artwork->published_at)->toBeNull(); }); it('rejects upload drafts with raw html in the description', function (): void { $user = User::factory()->create(); actingAs($user); postJson('/api/artworks', [ 'title' => 'Upload draft test', 'description' => '', 'is_mature' => false, ])->assertStatus(422) ->assertJsonValidationErrors(['description']); });