summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/email/html_to_markdown_parser_spec.rb
blob: fe585d47d59e6efdeed5e679ff453b4977995af1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Email::HtmlToMarkdownParser, feature_category: :service_desk do
  subject { described_class.convert(html) }

  describe '.convert' do
    let(:html) { fixture_file("lib/gitlab/email/basic.html") }

    it 'parses html correctly' do
      expect(subject)
      .to eq(
        <<-BODY.strip_heredoc.chomp
          Hello, World!
          This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
          *Even* mismatched tags.
          A div
          Another div
          A div
          **within** a div

          Another line
          Yet another line
          [A link](http://foo.com)
          <details>
          <summary>
          One</summary>
          Some details</details>

          <details>
          <summary>
          Two</summary>
          Some details</details>

          ![Miro](http://img.png)
          Col A	Col B
          Data A1	Data B1
          Data A2	Data B2
          Data A3	Data B4
          Total A	Total B
        BODY
      )
    end
  end
end