2019-04-30 08:27:42 +08:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2022-07-28 10:27:38 +08:00
|
|
|
|
RSpec.describe Import::Normalize do
|
2014-06-06 08:34:21 +08:00
|
|
|
|
describe "#normalize_code_blocks" do
|
|
|
|
|
it "normalizes 2 code blocks correctly" do
|
|
|
|
|
markdown = <<MD
|
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
<code>
|
|
|
|
|
I am a te "
|
|
|
|
|
</code></pre>
|
|
|
|
|
test
|
|
|
|
|
<pre><code>this is a ""</code></pre>
|
|
|
|
|
MD
|
|
|
|
|
expected =
|
|
|
|
|
" \n \n```\n I am a te \"\n \n```\n\n test \n \n```\nthis is a \"\"\n```\n\n"
|
2015-01-10 00:34:37 +08:00
|
|
|
|
expect(Import::Normalize.normalize_code_blocks(markdown)).to eq(expected)
|
2014-06-06 08:34:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|