DEV: add specs for Vanilla import script improvements (#11712)

This commit is contained in:
Arpit Jalan 2021-01-16 19:35:19 +05:30 committed by GitHub
parent 06d318820a
commit 869d25b7d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -37,6 +37,24 @@ describe VanillaBodyParser do
this starts with spaces but IS NOT a quote'''
end
it 'replaces pre tags with code backticks' do
complex_html = '<pre class="CodeBlock">foobar</pre>'
parsed = VanillaBodyParser.new({ 'Format' => 'Html', 'Body' => complex_html }, user_id).parse
expect(parsed).to eq "\n```\nfoobar\n```\n"
end
it 'strips code tags' do
complex_html = '<code>foobar</code>'
parsed = VanillaBodyParser.new({ 'Format' => 'Html', 'Body' => complex_html }, user_id).parse
expect(parsed).to eq "foobar"
end
it 'replaces div with quote class to bbcode quotes' do
complex_html = '<div class="Quote">foobar</div>'
parsed = VanillaBodyParser.new({ 'Format' => 'Html', 'Body' => complex_html }, user_id).parse
expect(parsed).to eq "\n\n[quote]\n\nfoobar\n\n[/quote]\n\n"
end
describe 'rich format' do
let(:rich_bodies) { JSON.parse(File.read('spec/fixtures/json/vanilla-rich-posts.json')).deep_symbolize_keys }