# frozen_string_literal: true RSpec.describe DiscourseAi::Utils::DiffUtils do describe ".apply_hunk" do subject(:apply_hunk) { described_class.apply_hunk(original_text, diff) } context "with HTML content" do let(:original_text) { <<~HTML }

Original Title

Some content here

HTML context "when adding content" do let(:diff) { <<~DIFF }

Original Title

+

New Subtitle

Some content here

DIFF it "inserts the new content" do expected = <<~HTML

Original Title

New Subtitle

Some content here

HTML expect(apply_hunk).to eq(expected.strip) end end context "when removing content" do let(:diff) { <<~DIFF }