true, 'comment_spam.mode' => 'enforce', 'comment_spam.ai_enabled' => false, 'comment_spam.captcha.enabled' => false, ]); $user = User::factory()->create(); $artwork = Artwork::factory()->create(); $content = 'copy paste this known spam signature'; $hash = hash('sha256', mb_strtolower((string) preg_replace('/\s+/u', ' ', trim($content)))); $signature = CommentSpamSignature::query()->create([ 'content_hash' => $hash, 'source' => 'spam', 'reason' => 'Known promotional spam.', 'confidence' => 100, 'hit_count' => 0, 'created_at' => now(), ]); $this->actingAs($user) ->postJson("/api/artworks/{$artwork->id}/comments", [ 'content' => $content, ]) ->assertCreated(); expect((int) $signature->fresh()->hit_count)->toBe(1); $comment = ArtworkComment::query()->latest('id')->first(); expect($comment)->not->toBeNull() ->and((bool) $comment->is_approved)->toBeFalse() ->and((string) $comment->moderation_source)->toBe('signature'); });