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

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

require 'spec_helper'

RSpec.describe Banzai::Filter::JiraImport::AdfToCommonmarkFilter do
  include FilterSpecHelper

  let_it_be(:fixtures_path) { 'lib/kramdown/atlassian_document_format' }

  it 'renders a complex document' do
    source = fixture_file(File.join(fixtures_path, 'complex_document.json'))
    target = fixture_file(File.join(fixtures_path, 'complex_document.md'))

    expect(filter(source)).to eq target
  end

  it 'renders original source when it is invalid JSON' do
    source = fixture_file(File.join(fixtures_path, 'invalid_json.json'))

    expect(filter(source)).to eq "Invalid Atlassian Document Format JSON\n\n#{source}"
  end

  it 'renders original source when missing document node' do
    source = fixture_file(File.join(fixtures_path, 'invalid_no_doc.json'))

    expect(filter(source)).to eq "Invalid Atlassian Document Format JSON\n\n#{source}"
  end
end