2023-10-29 03:21:59 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-11-06 14:54:57 +00:00
|
|
|
describe FlathubInlineMacro do
|
2023-10-29 03:21:59 +00:00
|
|
|
it 'should create a Flathub link to Icon Library app' do
|
|
|
|
input = 'flathub:org.gnome.design.IconLibrary[]'
|
|
|
|
|
|
|
|
expected = <<~RESULT
|
|
|
|
<a href="https://flathub.org/apps/org.gnome.design.IconLibrary">Icon Library</a>
|
|
|
|
RESULT
|
|
|
|
|
|
|
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
|
|
|
(expect actual).to include expected.chomp
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should create a Flathub link to Icon Library with replaced caption' do
|
|
|
|
input = 'flathub:org.gnome.design.IconLibrary[GNOME Icon Library]'
|
|
|
|
|
|
|
|
expected = <<~RESULT
|
|
|
|
<a href="https://flathub.org/apps/org.gnome.design.IconLibrary">GNOME Icon Library</a>
|
|
|
|
RESULT
|
|
|
|
|
|
|
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
|
|
|
(expect actual).to include expected.chomp
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should fail to create a link to Flathub due to non-existent app' do
|
|
|
|
input = 'flathub:example.com.SomeNonexistentApp[]'
|
|
|
|
|
|
|
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should still fail to link with replaced caption to a non-existent app in Flathub' do
|
|
|
|
input = 'flathub:example.com.SomeNonexistentApp[replacing the caption]'
|
|
|
|
|
|
|
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
|
|
|
end
|
|
|
|
end
|