Welcome to mirror list, hosted at ThFree Co, Russian Federation.

slack_markdown_sanitizer_spec.rb « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d9552542465b3f3c2da75e85915c2536701bdfb5 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SlackMarkdownSanitizer, feature_category: :integrations do
  describe '.sanitize' do
    using RSpec::Parameterized::TableSyntax

    where(:input, :output) do
      nil                              | nil
      ''                               | ''
      '[label](url)'                   | 'label(url)'
      '<url|label>'                    | 'urllabel'
      '<a href="url">label</a>'        | 'a href="url"label/a'
    end

    with_them do
      it 'returns the expected output' do
        expect(described_class.sanitize(input)).to eq(output)
      end
    end
  end

  describe '.sanitize_slack_link' do
    using RSpec::Parameterized::TableSyntax

    where(:input, :output) do
      ''                               | ''
      '[label](url)'                   | '[label](url)'
      '<url|label>'                    | '&lt;url|label&gt;'
      '<a href="url">label</a>'        | '<a href="url">label</a>'
    end

    with_them do
      it 'returns the expected output' do
        expect(described_class.sanitize_slack_link(input)).to eq(output)
      end
    end
  end
end