discourse/spec/components/import/normalize_spec.rb

23 lines
645 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
require "rails_helper"
require_dependency "import/normalize"
describe Import::Normalize do
describe "#normalize_code_blocks" do
it "normalizes 2 code blocks correctly" do
markdown = <<MD
&nbsp;
<pre>
<code>
I am a te&nbsp;&quot;
</code></pre>
test &nbsp;
<pre><code>this is a &quot;&quot;</code></pre>
MD
expected = " &nbsp;\n \n```\n I am a te \"\n \n```\n\n test &nbsp;\n \n```\nthis is a \"\"\n```\n\n"
expect(Import::Normalize.normalize_code_blocks(markdown)).to eq(expected)
end
end
end