mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-01-30 22:57:56 +00:00
Add spec tests for FDroid link inline macro
This commit is contained in:
parent
89c4313d17
commit
e2ca9b57f1
37
spec/fdroid_link_inline_macro_spec.rb
Normal file
37
spec/fdroid_link_inline_macro_spec.rb
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
describe FDroidLinkInlineMacro do
|
||||||
|
it 'should create a FDroid link' do
|
||||||
|
input = 'fdroid:org.moire.ultrasonic[]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://f-droid.org/en/packages/org.moire.ultrasonic">Ultrasonic</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should create a FDroid link with replaced caption' do
|
||||||
|
input = 'fdroid:org.moire.ultrasonic[a Subsonic client]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://f-droid.org/en/packages/org.moire.ultrasonic">a Subsonic client</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should fail to create a link due to non-existent app' do
|
||||||
|
input = 'fdroid:com.example.NonExistentAppOrSomething[]'
|
||||||
|
|
||||||
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should fail to create a link due to non-existent app even with replaced caption' do
|
||||||
|
input = 'fdroid:com.example.NonExistentAppOrSomething[non-existent app]'
|
||||||
|
|
||||||
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user